[MERGED] 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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jan 31 14:27:57 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: tests: null-terminate buffer
......................................................................


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(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: Icdde701839e35d3131605ea5a11882af21c8939a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Tom Tsou <tom at tsou.cc>



More information about the gerrit-log mailing list