diff options
author | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-03-17 16:06:20 +0000 |
---|---|---|
committer | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-03-17 16:06:20 +0000 |
commit | c95b6fd8956002a92b71af1afcd3a8105ba41358 (patch) | |
tree | b641ae259a9dbc5be5f90e94b8403428753160c0 /randpkt.c | |
parent | 15a1a700e9fc1a2affc7e04afd46595d2d9e3270 (diff) |
Insert "%s" at various points in an attempt to trigger format string bugs.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13792 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'randpkt.c')
-rw-r--r-- | randpkt.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -471,7 +471,13 @@ main(int argc, char **argv) pkthdr.ts.tv_sec = i; /* just for variety */ for (j = example->sample_length; j < len_random; j++) { - buffer[j] = (rand() % 0x100); + /* Add format strings here and there */ + if ((int) (100.0*rand()/(RAND_MAX+1.0)) < 3 && j < (len_random - 3)) { + memcpy(&buffer[j], "%s", 3); + j += 2; + } else { + buffer[j] = (rand() % 0x100); + } } wtap_dump(dump, &pkthdr, &ps_header, &buffer[0], &err); |