]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add a logic-consistency test when parsing unix socket configs
authorNick Mathewson <nickm@torproject.org>
Mon, 17 Oct 2016 12:27:10 +0000 (08:27 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 17 Oct 2016 12:27:10 +0000 (08:27 -0400)
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

index e3aa6d9d69be061a6311b169cb91c183655ec162..08c576e3d402e2ea51feb6c3bbb40769b2776e94 100644 (file)
@@ -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;