You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/test/Sema/warn-fortify-scanf.c
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -59,10 +59,17 @@ void call_fscanf(void) {
59
59
charbuf20[20];
60
60
charbuf30[30];
61
61
fscanf(0, "%4s %5s %10s", buf20, buf30, buf10); // expected-warning {{'fscanf' may overflow; destination buffer in argument 5 has size 10, but the corresponding specifier may require size 11}}
62
+
// expected-warning@-1 {{null passed to a callee that requires a non-null argument}}
62
63
fscanf(0, "%4s %5s %11s", buf20, buf30, buf10); // expected-warning {{'fscanf' may overflow; destination buffer in argument 5 has size 10, but the corresponding specifier may require size 12}}
64
+
// expected-warning@-1 {{null passed to a callee that requires a non-null argument}}
63
65
fscanf(0, "%4s %5s %9s", buf20, buf30, buf10);
66
+
// expected-warning@-1 {{null passed to a callee that requires a non-null argument}}
64
67
fscanf(0, "%20s %5s %9s", buf20, buf30, buf10); // expected-warning {{'fscanf' may overflow; destination buffer in argument 3 has size 20, but the corresponding specifier may require size 21}}
68
+
// expected-warning@-1 {{null passed to a callee that requires a non-null argument}}
65
69
fscanf(0, "%21s %5s %9s", buf20, buf30, buf10); // expected-warning {{'fscanf' may overflow; destination buffer in argument 3 has size 20, but the corresponding specifier may require size 22}}
70
+
// expected-warning@-1 {{null passed to a callee that requires a non-null argument}}
66
71
fscanf(0, "%19s %5s %9s", buf20, buf30, buf10);
72
+
// expected-warning@-1 {{null passed to a callee that requires a non-null argument}}
67
73
fscanf(0, "%19s %29s %9s", buf20, buf30, buf10);
74
+
// expected-warning@-1 {{null passed to a callee that requires a non-null argument}}
0 commit comments