CPP: Add local dataflow to (one bit of) OverflowStatic.ql.

This commit is contained in:
Geoffrey White
2018-11-21 18:30:24 +00:00
parent 01ba635e1d
commit ea56a5d9ce
3 changed files with 18 additions and 8 deletions

View File

@@ -6,3 +6,4 @@
| test.cpp:20:3:20:12 | access to array | Potential buffer-overflow: counter 'i' <= 3 but 'buffer2' has 3 elements. |
| test.cpp:24:27:24:27 | 4 | Potential buffer-overflow: 'buffer1' has size 3 not 4. |
| test.cpp:26:27:26:27 | 4 | Potential buffer-overflow: 'buffer2' has size 3 not 4. |
| test.cpp:40:22:40:27 | amount | Potential buffer-overflow: 'buffer' has size 100 not 101. |

View File

@@ -37,7 +37,7 @@ void f2(char *src)
amount = amount + 1;
memcpy(buffer, src, amount); // BAD [NOT DETECTED]
amount = 101;
memcpy(buffer, src, amount); // BAD [NOT DETECTED]
memcpy(buffer, src, amount); // BAD
ptr = buffer;
memcpy(ptr, src, 101); // BAD [NOT DETECTED]