Skip to content

Commit a9b7fed

Browse files
committed
C++: Accept test changes.
1 parent ac90259 commit a9b7fed

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-242/semmle/tests/OverrunWrite.expected

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44
| tests.cpp:273:2:273:8 | call to sprintf | This 'call to sprintf' operation requires 9 bytes but the destination is only 8 bytes. |
55
| tests.cpp:308:3:308:9 | call to sprintf | This 'call to sprintf' operation requires 9 bytes but the destination is only 8 bytes. |
66
| tests.cpp:315:2:315:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
7-
| tests.cpp:316:2:316:8 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
8-
| tests.cpp:318:3:318:9 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
7+
| tests.cpp:316:2:316:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
98
| tests.cpp:321:2:321:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
109
| tests.cpp:324:3:324:9 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
1110
| tests.cpp:327:2:327:8 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
1211
| tests.cpp:329:3:329:9 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
13-
| tests.cpp:332:4:332:10 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
14-
| tests.cpp:336:2:336:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
15-
| tests.cpp:337:2:337:8 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
16-
| tests.cpp:338:2:338:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
17-
| tests.cpp:339:2:339:8 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |

cpp/ql/test/query-tests/Security/CWE/CWE-242/semmle/tests/tests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ void test6(unsigned unsigned_value, int value) {
315315
sprintf(buffer, "%u", unsigned_value); // BAD: buffer overflow
316316
sprintf(buffer, "%d", unsigned_value); // BAD: buffer overflow
317317
if (unsigned_value < 10) {
318-
sprintf(buffer, "%u", unsigned_value); // GOOD [FALSE POSITIVE]
318+
sprintf(buffer, "%u", unsigned_value); // GOOD
319319
}
320320

321321
sprintf(buffer, "%u", -10); // BAD: buffer overflow
@@ -329,12 +329,12 @@ void test6(unsigned unsigned_value, int value) {
329329
sprintf(buffer, "%d", value); // BAD: buffer overflow
330330

331331
if(value > 0) {
332-
sprintf(buffer, "%d", value); // GOOD [FALSE POSITIVE]
332+
sprintf(buffer, "%d", value); // GOOD
333333
}
334334
}
335335

336-
sprintf(buffer, "%u", 0); // GOOD [FALSE POSITIVE]
337-
sprintf(buffer, "%d", 0); // GOOD [FALSE POSITIVE]
338-
sprintf(buffer, "%u", 5); // GOOD [FALSE POSITIVE]
339-
sprintf(buffer, "%d", 5); // GOOD [FALSE POSITIVE]
336+
sprintf(buffer, "%u", 0); // GOOD
337+
sprintf(buffer, "%d", 0); // GOOD
338+
sprintf(buffer, "%u", 5); // GOOD
339+
sprintf(buffer, "%d", 5); // GOOD
340340
}

0 commit comments

Comments
 (0)