[tor-commits] [tor/release-0.3.5] Always initialize addr in parse_port_config()

nickm at torproject.org nickm at torproject.org
Tue Dec 18 18:56:27 UTC 2018


commit 4894d44ab8beee587c99a1765236813d445b392e
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Dec 17 09:38:42 2018 -0500

    Always initialize addr in parse_port_config()
    
    It was always analyzed before use, but scan-build wasn't able to
    persuade itself of that.
    
    Closes ticket 28881.
---
 changes/ticket28881     | 4 ++++
 src/app/config/config.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/changes/ticket28881 b/changes/ticket28881
new file mode 100644
index 000000000..1b015a6c3
--- /dev/null
+++ b/changes/ticket28881
@@ -0,0 +1,4 @@
+  o Code simplification and refactoring:
+    -  When parsing a port configuration, make it more
+       obvious to static analyzer tools that we will always initialize the
+       address. Closes ticket 28881.
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 81cc3e378..4a8f94da0 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -6913,6 +6913,8 @@ parse_port_config(smartlist_t *out,
 
   for (; ports; ports = ports->next) {
     tor_addr_t addr;
+    tor_addr_make_unspec(&addr);
+
     int port;
     int sessiongroup = SESSION_GROUP_UNSET;
     unsigned isolation = ISO_DEFAULT;





More information about the tor-commits mailing list