aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-10-21 12:14:55 +0200
committerHarald Welte <laforge@gnumonks.org>2018-10-21 12:14:55 +0200
commitf5e1cf8790db5db655d08b5e93e78dbfd6df29d6 (patch)
tree432fbbaeafb72e068809157f733fa942200dd413
parente7d267f17883b76bd3964a1e5ce11b189ec9b409 (diff)
SocketsTest.testReaderIP(): Zero terminate received buffer
-rw-r--r--tests/CommonLibs/SocketsTest.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/CommonLibs/SocketsTest.cpp b/tests/CommonLibs/SocketsTest.cpp
index eb92e25..e4eef54 100644
--- a/tests/CommonLibs/SocketsTest.cpp
+++ b/tests/CommonLibs/SocketsTest.cpp
@@ -47,9 +47,10 @@ void *testReaderIP(void *param)
readSocket->nonblocking();
int rc = 0;
while (rc<gNumToSend) {
- char buf[MAX_UDP_LENGTH] = { 0 };
+ char buf[MAX_UDP_LENGTH+1] = { 0 };
int count = readSocket->read(buf, MAX_UDP_LENGTH);
if (count>0) {
+ buf[count] = 0;
CERR("read: " << buf);
rc++;
} else {