summaryrefslogtreecommitdiff
path: root/proto-shell.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-03 02:37:54 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-03 02:37:54 +0200
commit40450b303077d925339d50395ecf79629ff0ba72 (patch)
treed2492da0740cebf5ae67b37e757dcf6cb28dd01a /proto-shell.c
parentf6b38cb7c9ad0e7feba7cb7d2a1678af5e032000 (diff)
downloadnetifd-40450b303077d925339d50395ecf79629ff0ba72.tar.gz
fix a heap overrun
Diffstat (limited to 'proto-shell.c')
-rw-r--r--proto-shell.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/proto-shell.c b/proto-shell.c
index 5937e52..555004e 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -382,11 +382,11 @@ proto_shell_parse_config(struct config_param_list *config, json_object *obj)
int str_len = 0;
int i;
- attrs = calloc(1, sizeof(*attrs));
+ config->n_params = json_object_array_length(obj);
+ attrs = calloc(1, sizeof(*attrs) * config->n_params);
if (!attrs)
return NULL;
- config->n_params = json_object_array_length(obj);
config->params = attrs;
for (i = 0; i < config->n_params; i++) {
json_object *cur, *name, *type;