Skip to content

Commit 547342c

Browse files
authored
Update test.cpp
1 parent 1a30b8d commit 547342c

File tree

1 file changed

+6
-6
lines changed
  • cpp/ql/test/experimental/query-tests/Security/CWE/CWE-754/semmle/tests

1 file changed

+6
-6
lines changed

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-754/semmle/tests/test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ int functionWork2() {
5151
char a[10] = "";
5252
int b = 1;
5353
int *p = &b;
54-
scanf("%i", &i); // GOOD:the error can be determined by examining the initial value.
55-
scanf("%s", a); // GOOD:the error can be determined by examining the initial value.
56-
scanf("%i", p); // GOOD:the error can be determined by examining the initial value.
54+
scanf("%i", &i); // GOOD:Argument initialized even when scanf fails.
55+
scanf("%s", a); // GOOD:Argument initialized even when scanf fails.
56+
scanf("%i", p); // GOOD:Argument initialized even when scanf fails.
5757
return i;
5858
}
5959

@@ -65,9 +65,9 @@ int functionWork2_() {
6565
int b;
6666
b=1;
6767
int *p = &b;
68-
scanf("%i", &i); // GOOD:the error can be determined by examining the initial value.
69-
scanf("%s", a); // GOOD:the error can be determined by examining the initial value.
70-
scanf("%i", p); // GOOD:the error can be determined by examining the initial value.
68+
scanf("%i", &i); // GOOD:Argument initialized even when scanf fails.
69+
scanf("%s", a); // GOOD:Argument initialized even when scanf fails.
70+
scanf("%i", p); // GOOD:Argument initialized even when scanf fails.
7171
return i;
7272
}
7373
int functionWork2b() {

0 commit comments

Comments
 (0)