config: correctly break string for prefix filter
[project/odhcpd.git] / src / config.c
index b36afb1285556cbe3d7b51bd4eab78e997473c96..9ae8466991f7c8ec53b0bffcdd2a845a050d53b0 100644 (file)
@@ -730,14 +730,15 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
                char *astr = malloc(strlen(str) + 1);
                char *delim;
                int l;
+
                if (!astr || !strcpy(astr, str) ||
-                               (delim = strchr(astr, '/')) == NULL || (*(delim++) == 0) ||
+                               (delim = strchr(astr, '/')) == NULL || (*(delim++) = 0) ||
                                sscanf(delim, "%i", &l) == 0 || l > 128 ||
-                               inet_pton(AF_INET6, astr, &iface->pio_filter_addr) == 0) {
+                               inet_pton(AF_INET6, astr, &iface->pio_filter_addr) == 0)
                        iface->pio_filter_length = 0;
-               } else {
+               else
                        iface->pio_filter_length = l;
-               }
+
                if (astr)
                        free(astr);
        }