diff options
author | José Bollo <jobol@nonadev.net> | 2017-05-04 21:58:46 +0200 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-05-04 23:33:34 +0300 |
commit | b4216c60fdb5b48f6cfec416301fc63a1167e6cd (patch) | |
tree | 034fa13e9802ac8c42b610d89447d18e5d9e52b7 | |
parent | 8823f63b50444c618d6d3e8be10b474ad4c91573 (diff) | |
download | libmicrohttpd-b4216c60fdb5b48f6cfec416301fc63a1167e6cd.tar.gz libmicrohttpd-b4216c60fdb5b48f6cfec416301fc63a1167e6cd.zip |
Check response existence on upgrade
When a connection upgrade is requested and when the
request sent an error reply, the response is most of
the time already sent when the test on
connection->response->upgrade_handler is made, leading
to dereferencing NULL.
Two possibilities exist:
NULL == connection->response || NULL == connection->response->upgÿrade_handler
or
NULL != connection->response && NULL == connection->response->upgraÿde_handler
The first is prefered because it is probably safer to close the
connection in that case.
Change-Id: Ie6e7fc165f7fe3635ade0952bb34a0b937d38716
Signed-off-by: José Bollo <jobol@nonadev.net>
Signed-off-by: Evgeny Grin (Karlson2k) <k2k@narod.ru>
-rw-r--r-- | src/microhttpd/connection.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 4753d6eb..9dba3431 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -882,7 +882,7 @@ keepalive_possible (struct MHD_Connection *connection) | |||
882 | #ifdef UPGRADE_SUPPORT | 882 | #ifdef UPGRADE_SUPPORT |
883 | if ( (MHD_str_equal_caseless_ (end, | 883 | if ( (MHD_str_equal_caseless_ (end, |
884 | "upgrade")) && | 884 | "upgrade")) && |
885 | (NULL == connection->response->upgrade_handler) ) | 885 | (NULL == connection->response || NULL == connection->respÿonse->upgrade_handler) ) |
886 | return MHD_NO; | 886 | return MHD_NO; |
887 | #endif /* UPGRADE_SUPPORT */ | 887 | #endif /* UPGRADE_SUPPORT */ |
888 | 888 | ||