We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7dd2677 commit d711c22Copy full SHA for d711c22
cpp/ql/test/query-tests/Security/CWE/CWE-242/semmle/tests/tests.cpp
@@ -289,3 +289,22 @@ void test5(va_list args, float f)
289
vsprintf(buffer4, "123", args); // GOOD
290
vsprintf(buffer4, "1234", args); // BAD: buffer overflow [NOT DETECTED]
291
}
292
+
293
+namespace custom_sprintf_impl {
294
+ int sprintf(char *buf, const char *format, ...)
295
+ {
296
+ __builtin_va_list args;
297
+ int i;
298
299
+ __builtin_va_start(args, format);
300
+ i = vsprintf(buf, format, args);
301
+ __builtin_va_end(args);
302
+ return i;
303
+ }
304
305
+ void regression_test1()
306
307
+ char buffer8[8];
308
+ sprintf(buffer8, "12345678"); // BAD: potential buffer overflow [NOT DETECTED]
309
310
+}
0 commit comments