From 6387d164bb0900cd01b7ff584fa17013bd0eb661 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 28 Sep 2012 07:55:48 -0700 Subject: bugfix: fixed wrong bufferlength for snprintf in tcpflood.c The problem occured when using the -f (dynafiles) option, and caused some tests to fail. --- tests/tcpflood.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/tcpflood.c') diff --git a/tests/tcpflood.c b/tests/tcpflood.c index f3a89c77..fbd67de9 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -360,7 +360,7 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst) } while(!done); /* Attention: do..while()! */ } else if(MsgToSend == NULL) { if(dynFileIDs > 0) { - snprintf(dynFileIDBuf, maxBuf, "%d:", rand() % dynFileIDs); + snprintf(dynFileIDBuf, 128, "%d:", rand() % dynFileIDs); } if(extraDataLen == 0) { *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%c", -- cgit v1.2.3 From f50511a348b5717c93494a1bab93a9d24ef65df3 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 2 Oct 2012 11:21:40 +0200 Subject: cleanup --- tests/tcpflood.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/tcpflood.c') diff --git a/tests/tcpflood.c b/tests/tcpflood.c index fbd67de9..8fd347f1 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -360,7 +360,7 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst) } while(!done); /* Attention: do..while()! */ } else if(MsgToSend == NULL) { if(dynFileIDs > 0) { - snprintf(dynFileIDBuf, 128, "%d:", rand() % dynFileIDs); + snprintf(dynFileIDBuf, sizeof(dynFileIDBuf), "%d:", rand() % dynFileIDs); } if(extraDataLen == 0) { *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%c", -- cgit v1.2.3