[tor-commits] [tor/master] Add a logic-consistency test when parsing unix socket configs

nickm at torproject.org nickm at torproject.org
Mon Oct 17 12:28:10 UTC 2016


commit df84536ac129da6ad5c96cc5cd3dce9c4a1f39b7
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Oct 17 08:27:10 2016 -0400

    Add a logic-consistency test when parsing unix socket configs
    
    Coverity couldn't tell that 'addrport' was always non-NULL at this
    point in the function, so I'm adding an explicit check. This closes
    CID 1374060.
---
 src/or/config.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/or/config.c b/src/or/config.c
index e3aa6d9..08c576e 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -6592,6 +6592,8 @@ parse_port_config(smartlist_t *out,
     if (unix_socket_path) {
       port = 1;
     } else if (is_unix_socket) {
+      if (BUG(!addrport))
+        goto err; // LCOV_EXCL_LINE unreachable, but coverity can't tell that
       unix_socket_path = tor_strdup(addrport);
       if (!strcmp(addrport, "0"))
         port = 0;



More information about the tor-commits mailing list