Просмотр исходного кода

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.
Nick Mathewson 7 лет назад
Родитель
Сommit
df84536ac1
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      src/or/config.c

+ 2 - 0
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;