aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-23 11:50:25 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-23 11:50:25 +0000
commit016c03992e26690c5b321ad692351068ab2dbe83 (patch)
treeece1123eb14d6f5552442fa1108cc03404f577a4
parentced72bc239834da12bbd5faaf5812967b7c1fcfa (diff)
downloadlibmicrohttpd-016c03992e26690c5b321ad692351068ab2dbe83.tar.gz
libmicrohttpd-016c03992e26690c5b321ad692351068ab2dbe83.zip
fix double-free in case HTTPS_PRIORITIES value is set to an invalid string
-rw-r--r--src/daemon/daemon.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 6b47c1fc..b844ce38 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -1786,15 +1786,17 @@ parse_options_va (struct MHD_Daemon *daemon,
1786 ret = gnutls_priority_init (&daemon->priority_cache, 1786 ret = gnutls_priority_init (&daemon->priority_cache,
1787 pstr = va_arg (ap, const char*), 1787 pstr = va_arg (ap, const char*),
1788 NULL); 1788 NULL);
1789#if HAVE_MESSAGES
1790 if (ret != GNUTLS_E_SUCCESS) 1789 if (ret != GNUTLS_E_SUCCESS)
1790 {
1791#if HAVE_MESSAGES
1791 FPRINTF (stderr, 1792 FPRINTF (stderr,
1792 "Setting priorities to `%s' failed: %s\n", 1793 "Setting priorities to `%s' failed: %s\n",
1793 pstr, 1794 pstr,
1794 gnutls_strerror (ret)); 1795 gnutls_strerror (ret));
1795#endif 1796#endif
1796 if (ret != GNUTLS_E_SUCCESS) 1797 daemon->priority_cache = NULL;
1797 return MHD_NO; 1798 return MHD_NO;
1799 }
1798 } 1800 }
1799 break; 1801 break;
1800#endif 1802#endif
@@ -2053,7 +2055,8 @@ MHD_start_daemon_va (unsigned int options,
2053 if (MHD_YES != parse_options_va (retVal, &servaddr, ap)) 2055 if (MHD_YES != parse_options_va (retVal, &servaddr, ap))
2054 { 2056 {
2055#if HTTPS_SUPPORT 2057#if HTTPS_SUPPORT
2056 if (options & MHD_USE_SSL) 2058 if ( (0 != (options & MHD_USE_SSL)) &&
2059 (NULL != retVal->priority_cache) )
2057 gnutls_priority_deinit (retVal->priority_cache); 2060 gnutls_priority_deinit (retVal->priority_cache);
2058#endif 2061#endif
2059 free (retVal); 2062 free (retVal);