]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
scan-build: get_proxy_addrport should always set its outputs
authorNick Mathewson <nickm@torproject.org>
Sat, 19 Apr 2014 00:41:40 +0000 (20:41 -0400)
committerNick Mathewson <nickm@torproject.org>
Sat, 19 Apr 2014 00:41:40 +0000 (20:41 -0400)
When get_proxy_addrport returned PROXY_NONE, it would leave
addr/port unset. This is inconsistent, and could (if we used the
function in a stupid way) lead to undefined behavior. Bugfix on
5b050a9b0, though I don't think it affects tor-as-it-is.

src/or/connection.c

index 2e72e6b397deac74d449e6d845173778043e268c..5dbc47728364e88ee84b672c6f7b1b5670046242 100644 (file)
@@ -4814,6 +4814,8 @@ get_proxy_addrport(tor_addr_t *addr, uint16_t *port, int *proxy_type,
     }
   }
 
+  tor_addr_make_unspec(addr);
+  *port = 0;
   *proxy_type = PROXY_NONE;
   return 0;
 }