]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/stats: fixed potential crash on empty prefix
authorMarek Vavruša <marek.vavrusa@nic.cz>
Mon, 13 Jul 2015 14:16:27 +0000 (16:16 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Mon, 13 Jul 2015 14:16:27 +0000 (16:16 +0200)
modules/stats/stats.c

index 24d07d96f3205dd4eb0df7efb0a9d0a2169b8e54..078ff7b12e135b4782fbe10d85b2765e35dd6f6b 100644 (file)
@@ -264,7 +264,7 @@ static char* stats_list(void *env, struct kr_module *module, const char *args)
                        json_append_member(root, elm->key, json_mknumber(elm->val));
                }
        }
-       map_walk_prefixed(&data->map, args ? args : "", list_entry, root);
+       map_walk_prefixed(&data->map, (args_len > 0) ? args : "", list_entry, root);
        char *ret = json_encode(root);
        json_delete(root);
        return ret;