[PATCH] osmo-trx[master]: tests: null-terminate 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/.

Max gerrit-no-reply at lists.osmocom.org
Wed Jan 31 10:36:07 UTC 2018


Review at  https://gerrit.osmocom.org/6213

tests: null-terminate buffer

Initialize temporary buffer with 0 to make sure that it's
null-terminated.

Change-Id: Icdde701839e35d3131605ea5a11882af21c8939a
Fixes: CID149362
---
M tests/CommonLibs/SocketsTest.cpp
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/tests/CommonLibs/SocketsTest.cpp b/tests/CommonLibs/SocketsTest.cpp
index c4e31d8..eb92e25 100644
--- a/tests/CommonLibs/SocketsTest.cpp
+++ b/tests/CommonLibs/SocketsTest.cpp
@@ -47,7 +47,7 @@
 	readSocket->nonblocking();
 	int rc = 0;
 	while (rc<gNumToSend) {
-		char buf[MAX_UDP_LENGTH];
+		char buf[MAX_UDP_LENGTH] = { 0 };
 		int count = readSocket->read(buf, MAX_UDP_LENGTH);
 		if (count>0) {
 			CERR("read: " << buf);

-- 
To view, visit https://gerrit.osmocom.org/6213
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icdde701839e35d3131605ea5a11882af21c8939a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list