Change in osmo-trx[master]: SocketsTest.testReaderIP(): Zero terminate received buffer

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Oct 21 10:16:07 UTC 2018


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/11405


Change subject: SocketsTest.testReaderIP(): Zero terminate received buffer
......................................................................

SocketsTest.testReaderIP(): Zero terminate received buffer

Change-Id: Icd144e672ab15cfb0955897dd6eb529c56908eba
---
M tests/CommonLibs/SocketsTest.cpp
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/05/11405/1

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

-- 
To view, visit https://gerrit.osmocom.org/11405
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd144e672ab15cfb0955897dd6eb529c56908eba
Gerrit-Change-Number: 11405
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181021/549a0e3c/attachment.htm>


More information about the gerrit-log mailing list