[PATCH] osmo-mgw[master]: client: use osmo_strlcpy instead of strncpy

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
Mon Nov 27 11:18:53 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/5024

to look at the new patch set (#4).

client: use osmo_strlcpy instead of strncpy

simplify \nul termination of the ip_addr string

Change-Id: I94e3815f45d08e0d40faf41e580547de937c4ce8
---
M src/libosmo-mgcp-client/mgcp_client.c
M src/libosmo-mgcp/mgcp_conn.c
2 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/24/5024/4

diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index ac86f52..4b2ee91 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -201,8 +201,7 @@
 		goto response_parse_failure;
 
 	/* Extract IP-Address */
-	strncpy(r->audio_ip, line + 9, sizeof(r->audio_ip));
-	r->audio_ip[sizeof(r->audio_ip) - 1] = '\0';
+	osmo_strlcpy(r->audio_ip, line + 9, sizeof(r->audio_ip));
 
 	/* Check IP-Address */
 	if (inet_aton(r->audio_ip, &ip_test) == 0)
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 5861dbe..d4e1925 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -29,7 +29,8 @@
 #include <ctype.h>
 
 /* Allocate a new connection identifier. According to RFC3435, they must
- * be unique only within the scope of the endpoint. */
+ * be unique only within the scope of the endpoint. (Caller must provide
+ * memory for id) */
 static int mgcp_alloc_id(struct mgcp_endpoint *endp, char *id)
 {
 	int i;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I94e3815f45d08e0d40faf41e580547de937c4ce8
Gerrit-PatchSet: 4
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list