SocketsTest: Fix printing of non-nul-terminated string

Change-Id: I33d0ddf851d84b81ab5252e3755422170cee54ee
Fixes: Coverity CID#149363
This commit is contained in:
Harald Welte 2017-11-06 04:01:31 +09:00
parent b0e1bd8c22
commit 1468a5c3dc
1 changed files with 2 additions and 1 deletions

View File

@ -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);