Stefan Sperling has uploaded this change for review. ( 
https://gerrit.osmocom.org/11854


Change subject: fix use of partly initialized struct in tcp test
......................................................................

fix use of partly initialized struct in tcp test

Properly initialize sockaddr 'name' used by tcp test, and remove
a redundant re-declaration of this variable in a nested scope.

Change-Id: Id6e488308a72be96cca6aa661f088d2c3c67a6a3
Related: CID#188848
---
M test_apps/tcp.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libsmpp34 refs/changes/54/11854/1

diff --git a/test_apps/tcp.c b/test_apps/tcp.c
index 4e24fa5..4cf681d 100644
--- a/test_apps/tcp.c
+++ b/test_apps/tcp.c
@@ -69,7 +69,7 @@

     /* bind to a local addr */
     if (strlen(local_src) != 0) {
-        struct sockaddr_in name;
+        memset(&name, 0, sizeof(name));
         name.sin_family = AF_INET;
         name.sin_port = htons(local_port);
         name.sin_addr.s_addr = inet_addr(local_src);
@@ -91,6 +91,7 @@
     };

     memcpy(&addr.s_addr, _host.h_addr_list[0], sizeof(struct in_addr));
+    memset(&name, 0, sizeof(name));
     name.sin_family = AF_INET;
     name.sin_port = htons( port );
     name.sin_addr = addr;

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

Gerrit-Project: libsmpp34
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6e488308a72be96cca6aa661f088d2c3c67a6a3
Gerrit-Change-Number: 11854
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <[email protected]>

Reply via email to