aboutsummaryrefslogtreecommitdiffstats
path: root/randpkt.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2005-03-17 16:06:20 +0000
committerGerald Combs <gerald@wireshark.org>2005-03-17 16:06:20 +0000
commit73163bf8c5b0b2b12e653bdb47a50480c14cad85 (patch)
treeb641ae259a9dbc5be5f90e94b8403428753160c0 /randpkt.c
parent5162c81d7161214edf4a76803ed7e967ebd2d3bf (diff)
Insert "%s" at various points in an attempt to trigger format string bugs.
svn path=/trunk/; revision=13792
Diffstat (limited to 'randpkt.c')
-rw-r--r--randpkt.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/randpkt.c b/randpkt.c
index e93ed5f492..b443ddf7b9 100644
--- a/randpkt.c
+++ b/randpkt.c
@@ -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);