Change in libsmpp34[master]: fix use of partly initialized struct in tcp test

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/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Tue Nov 27 10:39:57 UTC 2018


Stefan Sperling has submitted this change and it was merged. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Neels Hofmeyr: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, approved



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: merged
Gerrit-Change-Id: Id6e488308a72be96cca6aa661f088d2c3c67a6a3
Gerrit-Change-Number: 11854
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181127/b8290a6e/attachment.htm>


More information about the gerrit-log mailing list