libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 016c03992e26690c5b321ad692351068ab2dbe83
parent ced72bc239834da12bbd5faaf5812967b7c1fcfa
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 23 Jan 2012 11:50:25 +0000

fix double-free in case HTTPS_PRIORITIES value is set to an invalid string

Diffstat:
Msrc/daemon/daemon.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c @@ -1786,15 +1786,17 @@ parse_options_va (struct MHD_Daemon *daemon, ret = gnutls_priority_init (&daemon->priority_cache, pstr = va_arg (ap, const char*), NULL); -#if HAVE_MESSAGES if (ret != GNUTLS_E_SUCCESS) + { +#if HAVE_MESSAGES FPRINTF (stderr, "Setting priorities to `%s' failed: %s\n", pstr, gnutls_strerror (ret)); #endif - if (ret != GNUTLS_E_SUCCESS) + daemon->priority_cache = NULL; return MHD_NO; + } } break; #endif @@ -2053,7 +2055,8 @@ MHD_start_daemon_va (unsigned int options, if (MHD_YES != parse_options_va (retVal, &servaddr, ap)) { #if HTTPS_SUPPORT - if (options & MHD_USE_SSL) + if ( (0 != (options & MHD_USE_SSL)) && + (NULL != retVal->priority_cache) ) gnutls_priority_deinit (retVal->priority_cache); #endif free (retVal);