Skip to content

Commit 3fa6704

Browse files
author
grothoff
committed
Matthew Mundell wrote:
Hi We've been having some mysterious parameter loss of POST parameters in OpenVAS's GSA. This only happens with IE8 and Chrome. We saw this with libmicrohttpd 0.9.19 and 0.9.20. The cause looks to be an error in libmicrohttpd. Patch to 0.9.20 to resolve below. In post_process_multipart in postprocessor.c the PP_Init state calls find_boundary to find the first boundary. If there is junk before the first boundary it just reads over the junk. However, it is also reading over the actual boundary when there was too little data to determine whether the next character is the start of the boundary. In the error case Chrome seems to sends the POST request in multiple writes. The first chunk includes a single "-" from the first boundary at end of the headers. Thus libmicrohttpd has a partial boundary to deal with. I guess Chrome intends to send just the headers but gets the count wrong due to sending the initial P of the POST on its own (all the browsers do that for some reason). Firefox on the other hand sends the headers and the body in a single write, so it always works. Thanks, and thanks for libmicrohttpd! Matt git-svn-id: https://gnunet.org/svn/libmicrohttpd@25267 140774ce-b5e7-0310-ab8b-a85725594a96
1 parent 5beb1a3 commit 3fa6704

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Sven Geggus <[email protected]>
3939
Steve Wolf <[email protected]>
4040
Brecht Sanders <[email protected]>
4141
Jan Janak <[email protected]>
42+
Matthew Mundell <[email protected]>
4243

4344
Documentation contributions also came from:
4445
Marco Maggi <[email protected]>

ChangeLog

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Wed Dec 5 19:22:26 CET 2012
2+
Fixing parameter loss of POST parameters with IE8 and Chrome
3+
in the PostProcessor as the code failed to properly handle
4+
partial data. -MM
5+
6+
Fri Nov 9 21:36:46 CET 2012
7+
Releasing libmicrohttpd 0.9.23. -CG
8+
19
Thu Nov 8 22:32:59 CET 2012
210
Ship our own version of tsearch and friends if not provided by platform,
311
so that MHD works nicely on Android. -JJ

config.guess

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
55
# 2011, 2012 Free Software Foundation, Inc.
66

7-
timestamp='2012-09-25'
7+
timestamp='2012-08-14'
88

99
# This file is free software; you can redistribute it and/or modify it
1010
# under the terms of the GNU General Public License as published by
@@ -306,7 +306,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
306306
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
307307
echo arm-acorn-riscix${UNAME_RELEASE}
308308
exit ;;
309-
arm*:riscos:*:*|arm*:RISCOS:*:*)
309+
arm:riscos:*:*|arm:RISCOS:*:*)
310310
echo arm-unknown-riscos
311311
exit ;;
312312
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)

configure.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
#
2222
#
2323
AC_PREREQ(2.57)
24-
AC_INIT([libmicrohttpd], [0.9.22],[[email protected]])
24+
AC_INIT([libmicrohttpd], [0.9.23],[[email protected]])
2525
AM_INIT_AUTOMAKE([silent-rules])
2626
AM_CONFIG_HEADER([MHD_config.h])
2727
AC_CONFIG_MACRO_DIR([m4])
2828
AH_TOP([#define _GNU_SOURCE 1])
2929

3030
LIB_VERSION_CURRENT=26
31-
LIB_VERSION_REVISION=1
31+
LIB_VERSION_REVISION=2
3232
LIB_VERSION_AGE=16
3333
AC_SUBST(LIB_VERSION_CURRENT)
3434
AC_SUBST(LIB_VERSION_REVISION)

src/daemon/postprocessor.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ find_boundary (struct MHD_PostProcessor *pp,
494494
{
495495
if (pp->buffer_pos == pp->buffer_size)
496496
pp->state = PP_Error; /* out of memory */
497+
++(*ioffptr);
497498
return MHD_NO; /* not enough data */
498499
}
499500
if ((0 != memcmp ("--", buf, 2)) || (0 != memcmp (&buf[2], boundary, blen)))
@@ -841,12 +842,11 @@ post_process_multipart (struct MHD_PostProcessor *pp,
841842
* > anything that appears before the first boundary delimiter
842843
* > line or after the last one.
843844
*/
844-
if (MHD_NO == find_boundary (pp,
845-
pp->boundary,
846-
pp->blen,
847-
&ioff,
848-
PP_ProcessEntryHeaders, PP_Done))
849-
++ioff;
845+
(void) find_boundary (pp,
846+
pp->boundary,
847+
pp->blen,
848+
&ioff,
849+
PP_ProcessEntryHeaders, PP_Done);
850850
break;
851851
case PP_NextBoundary:
852852
if (MHD_NO == find_boundary (pp,

src/include/microhttpd.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ extern "C"
106106
/**
107107
* Current version of the library.
108108
*/
109-
#define MHD_VERSION 0x00091600
109+
#define MHD_VERSION 0x00091700
110110

111111
/**
112112
* MHD-internal return code for "YES".

0 commit comments

Comments
 (0)