Explorar o código

scan-build: get_proxy_addrport should always set its outputs

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.
Nick Mathewson %!s(int64=10) %!d(string=hai) anos
pai
achega
895b6789e8
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/or/connection.c

+ 2 - 0
src/or/connection.c

@@ -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;
 }