浏览代码

fix over-read in %ls with non-wide scanf

Rich Felker 13 年之前
父节点
当前提交
2dd5dc78d4
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      src/stdio/vfscanf.c

+ 1 - 0
src/stdio/vfscanf.c

@@ -312,6 +312,7 @@ int vfscanf(FILE *f, const char *fmt, va_list ap)
 				if (readwc(c, &wcs, &st) < 0)
 					goto input_fail;
 			}
+			shunget(f);
 			if (!mbsinit(&st)) goto input_fail;
 			if (dest) *wcs++ = 0;
 			break;