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

dexter gerrit-no-reply at lists.osmocom.org
Fri Jan 19 09:37:22 UTC 2018


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

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


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/25/5925/1

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: newchange
Gerrit-Change-Id: I5a1187b13b21b11674f13d3449c730616b0a4ddf
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list