summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-01-03 15:01:50 +0100
committerFelix Fietkau <nbd@openwrt.org>2013-01-03 15:01:50 +0100
commit12931edab795b7caeb70323e2959b5e5503c5980 (patch)
treee87a58862d07d6a3dec7ff396673e1f22a98b57f /proc.c
parent73c843c1186c74e897022a3edb88d0d4f0ff27dc (diff)
fix use-after-realloc issue with the request url
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/proc.c b/proc.c
index 351b473..425576e 100644
--- a/proc.c
+++ b/proc.c
@@ -123,9 +123,11 @@ struct env_var *uh_get_process_vars(struct client *cl, struct path_info *pi)
struct blob_attr *data = cl->hdr.head;
struct env_var *vars = (void *) uh_buf;
struct blob_attr *tb[__HDR_MAX];
+ const char *url;
int len;
int i;
+ url = blobmsg_data(blob_data(cl->hdr.head));
len = ARRAY_SIZE(proc_header_env);
len += ARRAY_SIZE(extra_vars);
len *= sizeof(struct env_var);
@@ -136,7 +138,7 @@ struct env_var *uh_get_process_vars(struct client *cl, struct path_info *pi)
extra_vars[VAR_SCRIPT_FILE].value = pi->phys;
extra_vars[VAR_DOCROOT].value = pi->root;
extra_vars[VAR_QUERY].value = pi->query ? pi->query : "";
- extra_vars[VAR_REQUEST].value = req->url;
+ extra_vars[VAR_REQUEST].value = url;
extra_vars[VAR_PROTO].value = http_versions[req->version];
extra_vars[VAR_METHOD].value = http_methods[req->method];
extra_vars[VAR_PATH_INFO].value = pi->info;