summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cgi.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/cgi.c b/cgi.c
index 45e998ef..be6aa10b 100644
--- a/cgi.c
+++ b/cgi.c
@@ -165,7 +165,7 @@ html_printquery(const struct req *req)
}
if (NULL != req->q.expr) {
printf("&expr=");
- html_print(req->q.expr ? req->q.expr : "");
+ html_print(req->q.expr);
}
}
@@ -284,11 +284,13 @@ static int
http_decode(char *p)
{
char hex[3];
+ char *q;
int c;
hex[2] = '\0';
- for ( ; '\0' != *p; p++) {
+ q = p;
+ for ( ; '\0' != *p; p++, q++) {
if ('%' == *p) {
if ('\0' == (hex[0] = *(p + 1)))
return(0);
@@ -299,13 +301,13 @@ http_decode(char *p)
if ('\0' == c)
return(0);
- *p = (char)c;
- memmove(p + 1, p + 3, strlen(p + 3) + 1);
+ *q = (char)c;
+ p += 2;
} else
- *p = '+' == *p ? ' ' : *p;
+ *q = '+' == *p ? ' ' : *p;
}
- *p = '\0';
+ *q = '\0';
return(1);
}