Change in libosmocore[master]: gprs_ns_sns: Properly initialize sockaddr_in in gprs_nsvc_create_ip4()

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 Mar 20 07:32:45 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13332


Change subject: gprs_ns_sns: Properly initialize sockaddr_in in gprs_nsvc_create_ip4()
......................................................................

gprs_ns_sns: Properly initialize sockaddr_in in gprs_nsvc_create_ip4()

When putting together a sockaddr_in, we must not only set the IP
address and port, but also set the address family to AF_INET.  And
while at it, let's zero-initialize the entire 'struct sockdadr_in'.

Change-Id: I1c8d8fe7f79a2ec737baa7800247269c3271983e
---
M src/gb/gprs_ns_sns.c
1 file changed, 2 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/32/13332/1

diff --git a/src/gb/gprs_ns_sns.c b/src/gb/gprs_ns_sns.c
index cbaa468..dd8d3a2 100644
--- a/src/gb/gprs_ns_sns.c
+++ b/src/gb/gprs_ns_sns.c
@@ -88,6 +88,8 @@
 	struct gprs_nsvc *nsvc;
 	struct sockaddr_in sin;
 	/* copy over. Both data structures use network byte order */
+	memset(&sin, 0, sizeof(sin));
+	sin.sin_family = AF_INET;
 	sin.sin_addr.s_addr = ip4->ip_addr;
 	sin.sin_port = ip4->udp_port;
 

-- 
To view, visit https://gerrit.osmocom.org/13332
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c8d8fe7f79a2ec737baa7800247269c3271983e
Gerrit-Change-Number: 13332
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190320/dc02a255/attachment.htm>


More information about the gerrit-log mailing list