Test off by one bug in vfscanf

This commit is contained in:
oddcoder
2020-05-23 13:23:31 +02:00
parent d7d3e00867
commit 1b131b8c60
4 changed files with 10 additions and 0 deletions
+1
View File
@@ -44,6 +44,7 @@ EXPECT_NAMES=\
stdio/printf_space_pad \
stdio/ungetc_multiple \
stdio/ungetc_ftell \
stdio/fscanf_offby1 \
stdlib/a64l \
stdlib/alloc \
stdlib/atof \
@@ -0,0 +1 @@
1234, 7, 32
+8
View File
@@ -0,0 +1,8 @@
//1234 a
#include <stdio.h>
int main() {
FILE *f = fopen("stdio/fscanf_offby1.c", "r");
int x;
fscanf(f, "//%d", &x);
printf("%d, %ld, %d\n", x, ftell(f), fgetc(f));
}