summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Angelacos <nangel@alpinelinux.org>2015-03-11 19:12:33 +0000
committerNathan Angelacos <nangel@alpinelinux.org>2015-03-11 19:12:33 +0000
commitf2c0e230a549bb6e2f0329a6b7746b876913fd14 (patch)
tree394aa2d0124b58d4eb15dc123966efc8545343c1
parent22275203cc9f97b79ffdedcbe6b51e0086fa8cb6 (diff)
downloadhaserl-master.tar.bz2
haserl-master.tar.xz
Correct segfault when getenv(CONTENT_TYPE) returns NULLHEADmaster
-rw-r--r--ChangeLog5
-rw-r--r--configure.ac2
-rw-r--r--src/haserl.c19
3 files changed, 17 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index b98b758..a58f392 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 = "&";
}