mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Apply suggestions from code review
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,7 @@ int scanf(const char *format, ...);
|
||||
int globalVal;
|
||||
int functionWork1() {
|
||||
int i;
|
||||
if (scanf("%i", i) == 1) // GOOD
|
||||
if (scanf("%i", &i) == 1) // GOOD
|
||||
return i;
|
||||
else
|
||||
return -1;
|
||||
@@ -11,7 +11,7 @@ int functionWork1() {
|
||||
int functionWork1_() {
|
||||
int i;
|
||||
int r;
|
||||
r = scanf("%i", i);
|
||||
r = scanf("%i", &i);
|
||||
if (r == 1) // GOOD
|
||||
return i;
|
||||
else
|
||||
@@ -20,25 +20,25 @@ int functionWork1_() {
|
||||
|
||||
int functionWork1b() {
|
||||
int i;
|
||||
scanf("%i", i); // BAD
|
||||
scanf("%i", &i); // BAD
|
||||
return i;
|
||||
}
|
||||
|
||||
int functionWork2() {
|
||||
int i = 0;
|
||||
scanf("%i", i); // GOOD:the error can be determined by examining the initial value.
|
||||
scanf("%i", &i); // GOOD:the error can be determined by examining the initial value.
|
||||
return i;
|
||||
}
|
||||
|
||||
int functionWork2_() {
|
||||
int i;
|
||||
i = 0;
|
||||
scanf("%i", i); // GOOD:the error can be determined by examining the initial value.
|
||||
scanf("%i", &i); // GOOD:the error can be determined by examining the initial value.
|
||||
return i;
|
||||
}
|
||||
int functionWork2b() {
|
||||
int i;
|
||||
scanf("%i", i); // BAD
|
||||
scanf("%i", &i); // BAD
|
||||
globalVal = i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user