Fix various buffer overruns in fmt_scan.c; the bulk of this is passing