diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-03-20 08:30:29 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-03-20 08:32:30 +0100 |
commit | fa90cfd8d296503189d3075b8f1bf633204ddaa0 (patch) | |
tree | b7fedc83e450de516b5661d9495a07d146fd3f88 | |
parent | c0dfc9d885970f0116bf0e0af4cbe36c330f88bc (diff) |
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
-rw-r--r-- | src/gb/gprs_ns_sns.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gb/gprs_ns_sns.c b/src/gb/gprs_ns_sns.c index cbaa4685..dd8d3a2d 100644 --- a/src/gb/gprs_ns_sns.c +++ b/src/gb/gprs_ns_sns.c @@ -88,6 +88,8 @@ static struct gprs_nsvc *gprs_nsvc_create_ip4(struct gprs_ns_inst *nsi, 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; |