summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-11-26 10:35:57 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-11-26 10:35:57 -0500
commit0b80adac740c7eb8ec15d907b9d311b6a68076fc (patch)
treeefb1a62ae46a74a126502251cec49a83b5f80f96
parent68e0439b741bf84508f90b42611d681ced933874 (diff)
Fix parsing of long FastCGI lengths
-rw-r--r--src/c/fastcgi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/c/fastcgi.c b/src/c/fastcgi.c
index 7d2ce067..1a8a8316 100644
--- a/src/c/fastcgi.c
+++ b/src/c/fastcgi.c
@@ -223,7 +223,7 @@ static int read_funny_len(unsigned char **buf, int *len) {
else if (*len < 4)
return -1;
else {
- int r = (((*buf)[3] & 0x7f) << 24) + ((*buf)[2] << 16) + ((*buf)[1] << 8) + (*buf)[0];
+ int r = (((*buf)[0] & 0x7f) << 24) + ((*buf)[1] << 16) + ((*buf)[2] << 8) + (*buf)[3];
*buf += 4;
*len -= 4;
return r;
@@ -236,9 +236,9 @@ static int read_nvp(unsigned char **buf, int len, nvp *nv) {
if ((nameLength = read_funny_len(buf, &len)) < 0)
return -1;
if ((valueLength = read_funny_len(buf, &len)) < 0)
- return -1;
+ return -2;
if (len < nameLength + valueLength)
- return -1;
+ return -3;
if (nameLength+1 > nv->name_len) {
nv->name_len = nameLength+1;
@@ -374,7 +374,7 @@ static void *worker(void *data) {
goto done;
}
- write_stderr(out, "PARAM: %s -> %s\n", hs.nvps[used_nvps].name, hs.nvps[used_nvps].value);
+ //write_stderr(out, "PARAM: %s -> %s\n", hs.nvps[used_nvps].name, hs.nvps[used_nvps].value);
++used_nvps;
}