C++: Accept test changes.

This commit is contained in:
Mathias Vorreiter Pedersen
2021-11-04 21:25:37 +00:00
parent ac90259906
commit a9b7fed537
2 changed files with 7 additions and 13 deletions

View File

@@ -4,14 +4,8 @@
| tests.cpp:273:2:273:8 | call to sprintf | This 'call to sprintf' operation requires 9 bytes but the destination is only 8 bytes. |
| tests.cpp:308:3:308:9 | call to sprintf | This 'call to sprintf' operation requires 9 bytes but the destination is only 8 bytes. |
| tests.cpp:315:2:315:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
| tests.cpp:316:2:316:8 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
| tests.cpp:318:3:318:9 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
| tests.cpp:316:2:316:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
| tests.cpp:321:2:321:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
| tests.cpp:324:3:324:9 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
| tests.cpp:327:2:327:8 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
| tests.cpp:329:3:329:9 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
| tests.cpp:332:4:332:10 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
| tests.cpp:336:2:336:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
| tests.cpp:337:2:337:8 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |
| tests.cpp:338:2:338:8 | call to sprintf | This 'call to sprintf' operation requires 11 bytes but the destination is only 2 bytes. |
| tests.cpp:339:2:339:8 | call to sprintf | This 'call to sprintf' operation requires 12 bytes but the destination is only 2 bytes. |

View File

@@ -315,7 +315,7 @@ void test6(unsigned unsigned_value, int value) {
sprintf(buffer, "%u", unsigned_value); // BAD: buffer overflow
sprintf(buffer, "%d", unsigned_value); // BAD: buffer overflow
if (unsigned_value < 10) {
sprintf(buffer, "%u", unsigned_value); // GOOD [FALSE POSITIVE]
sprintf(buffer, "%u", unsigned_value); // GOOD
}
sprintf(buffer, "%u", -10); // BAD: buffer overflow
@@ -329,12 +329,12 @@ void test6(unsigned unsigned_value, int value) {
sprintf(buffer, "%d", value); // BAD: buffer overflow
if(value > 0) {
sprintf(buffer, "%d", value); // GOOD [FALSE POSITIVE]
sprintf(buffer, "%d", value); // GOOD
}
}
sprintf(buffer, "%u", 0); // GOOD [FALSE POSITIVE]
sprintf(buffer, "%d", 0); // GOOD [FALSE POSITIVE]
sprintf(buffer, "%u", 5); // GOOD [FALSE POSITIVE]
sprintf(buffer, "%d", 5); // GOOD [FALSE POSITIVE]
sprintf(buffer, "%u", 0); // GOOD
sprintf(buffer, "%d", 0); // GOOD
sprintf(buffer, "%u", 5); // GOOD
sprintf(buffer, "%d", 5); // GOOD
}