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 11:48:03 UTC 2018


Harald Welte has submitted this change and it was merged. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



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: merged
Gerrit-Change-Id: Icd144e672ab15cfb0955897dd6eb529c56908eba
Gerrit-Change-Number: 11405
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181021/739feed9/attachment.htm>


More information about the gerrit-log mailing list