summaryrefslogtreecommitdiffstats
path: root/usr.sbin/slowcgi
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2014-04-14 19:25:48 +0000
committerflorian <florian@openbsd.org>2014-04-14 19:25:48 +0000
commit10fd764f5d329da5f1933d823a8d401357dcb7cd (patch)
tree4a4bf9012834a0a82496251121f7daca1ec36a4c /usr.sbin/slowcgi
parentFlense all use of BIO_snprintf from ssl source - use the real one instead, (diff)
downloadwireguard-openbsd-10fd764f5d329da5f1933d823a8d401357dcb7cd.tar.xz
wireguard-openbsd-10fd764f5d329da5f1933d823a8d401357dcb7cd.zip
Calculate the length of name and value for parameters the right way
around for the 4 byte encoding. With this QUERY_STRING can be longer than 127 bytes. Found the hard way while playing with smokeping. OK benno@
Diffstat (limited to 'usr.sbin/slowcgi')
-rw-r--r--usr.sbin/slowcgi/slowcgi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/slowcgi/slowcgi.c b/usr.sbin/slowcgi/slowcgi.c
index 8d947d32e8c..215c466c52f 100644
--- a/usr.sbin/slowcgi/slowcgi.c
+++ b/usr.sbin/slowcgi/slowcgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slowcgi.c,v 1.29 2014/04/13 08:46:20 florian Exp $ */
+/* $OpenBSD: slowcgi.c,v 1.30 2014/04/14 19:25:48 florian Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
* Copyright (c) 2013 Florian Obser <florian@openbsd.org>
@@ -696,8 +696,8 @@ parse_params(uint8_t *buf, uint16_t n, struct request *c, uint16_t id)
buf++;
} else {
if (n > 3) {
- name_len = ((buf[3] & 0x7f) << 24) +
- (buf[2] << 16) + (buf[1] << 8) + buf[0];
+ name_len = ((buf[0] & 0x7f) << 24) +
+ (buf[1] << 16) + (buf[2] << 8) + buf[3];
n -= 4;
buf += 4;
} else
@@ -711,9 +711,9 @@ parse_params(uint8_t *buf, uint16_t n, struct request *c, uint16_t id)
buf++;
} else {
if (n > 3) {
- val_len = ((buf[3] & 0x7f) << 24) +
- (buf[2] << 16) + (buf[1] << 8) +
- buf[0];
+ val_len = ((buf[0] & 0x7f) << 24) +
+ (buf[1] << 16) + (buf[2] << 8) +
+ buf[3];
n -= 4;
buf += 4;
} else