diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-11-06 04:01:31 +0900 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-11-07 20:32:09 +0000 |
commit | 1468a5c3dc4c193422d0ccbe5e09e423395bbec5 (patch) | |
tree | 1f82db1df1066055989dcef616a2279eb21c868d | |
parent | b0e1bd8c228f3795031cebfac2533dfabed61112 (diff) |
SocketsTest: Fix printing of non-nul-terminated string
Change-Id: I33d0ddf851d84b81ab5252e3755422170cee54ee
Fixes: Coverity CID#149363
-rw-r--r-- | CommonLibs/SocketsTest.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/CommonLibs/SocketsTest.cpp b/CommonLibs/SocketsTest.cpp index c2849e0..3198a5e 100644 --- a/CommonLibs/SocketsTest.cpp +++ b/CommonLibs/SocketsTest.cpp @@ -61,7 +61,8 @@ void *testReaderUnix(void *) readSocket.nonblocking(); int rc = 0; while (rc<gNumToSend) { - char buf[MAX_UDP_LENGTH]; + char buf[MAX_UDP_LENGTH+1]; + buf[MAX_UDP_LENGTH] = '\0'; int count = readSocket.read(buf, MAX_UDP_LENGTH); if (count>0) { COUT("read: " << buf); |