[MERGED] osmo-mgw[master]: cosmetic: protocol: remove unnecessary nul termination

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
Fri Jan 19 17:27:00 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: cosmetic: protocol: remove unnecessary nul termination
......................................................................


cosmetic: protocol: remove unnecessary nul termination

Adding a NUL manually is a common idiom after calling strncpy() because
strncpy() does not always NUL-terminate the string. But snprintf() is
fine.

- remove NUL termination after snprintf in mgcp_send_reset_ep()

Change-Id: I5a1187b13b21b11674f13d3449c730616b0a4ddf
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 0 insertions(+), 2 deletions(-)

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



diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 5f1a734..4c04712 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1242,8 +1242,6 @@
 	if (len < 0)
 		return -1;
 
-	buf[sizeof(buf) - 1] = '\0';
-
 	rc = send_agent(endp->cfg, buf, len);
 	if (rc <= 0)
 		return -1;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5a1187b13b21b11674f13d3449c730616b0a4ddf
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list