SocketsTest.testReaderIP(): Zero terminate received buffer

Change-Id: Icd144e672ab15cfb0955897dd6eb529c56908eba
This commit is contained in:
Harald Welte 2018-10-21 12:14:55 +02:00
parent e7d267f178
commit f5e1cf8790
1 changed files with 2 additions and 1 deletions

View File

@ -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 {