diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/haserl.c | 19 |
3 files changed, 17 insertions, 9 deletions
@@ -1,3 +1,8 @@ +2015-03-11 + 0.9.35 + * Geert Jan de Groot reported a possible segfault if CONTENT_TYPE is not + specified. This bug was introduced in 0.9.33 + 2015-02-15 0.9.34 * Fixes for Lua 5.3 compatibility diff --git a/configure.ac b/configure.ac index 030a5f3..d466f9f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT([haserl],[0.9.34],[Nathan Angelacos - nangel@users.sourceforge.net],[haserl]) +AC_INIT([haserl],[0.9.35],[Nathan Angelacos - nangel@users.sourceforge.net],[haserl]) AM_INIT_AUTOMAKE # Checks for programs. diff --git a/src/haserl.c b/src/haserl.c index b23a9da..3d405ab 100644 --- a/src/haserl.c +++ b/src/haserl.c @@ -1,5 +1,5 @@ /* -------------------------------------------------------------------------- - * Copyright 2003-2014 (inclusive) Nathan Angelacos + * Copyright 2003-2015 (inclusive) Nathan Angelacos * (nangel@users.sourceforge.net) * * This file is part of haserl. @@ -473,23 +473,26 @@ ReadCGIPOSTValues (list_t * env ) unsigned char *data; const char *CONTENT_LENGTH = "CONTENT_LENGTH"; const char *CONTENT_TYPE = "CONTENT_TYPE"; + char *content_type = NULL; if ((getenv (CONTENT_LENGTH) == NULL) || (strtoul (getenv (CONTENT_LENGTH), NULL, 10) == 0)) return (0); - if (strncasecmp (getenv (CONTENT_TYPE) , "multipart/form-data", 19) - == 0) - { + content_type = getenv(CONTENT_TYPE); + + if ( ( content_type != NULL ) && + ( strncasecmp ( content_type , "multipart/form-data", 19)) == 0 ) + { /* This is a mime request, we need to go to the mime handler */ i = rfc2388_handler (env); return (i); - } + } /* at this point its either urlencoded or some other blob */ - - if ( ( strncasecmp (getenv (CONTENT_TYPE), "application/x-www-form-urlencoded", 33) == 0 ) || - (getenv (CONTENT_TYPE) == NULL ) ) { + if ( (content_type == NULL ) || + ( strncasecmp (getenv (CONTENT_TYPE), "application/x-www-form-urlencoded", 33) == 0 ) ) + { urldecoding = 1; matchstr = "&"; } |