aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-06-07 12:26:28 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-06-08 09:54:39 +0300
commit45c7e2bc39a1620f2c853bd382175f874aa9f1bc (patch)
tree58c89af57e6e1681faf28f9d6e5a96ecd7413405
parent2106f6f2bb9bda5c56c33eb0f795b54c61b5a933 (diff)
downloadlibmicrohttpd-45c7e2bc39a1620f2c853bd382175f874aa9f1bc.tar.gz
libmicrohttpd-45c7e2bc39a1620f2c853bd382175f874aa9f1bc.zip
MHD_queue_response: check whether provided status code is a three digits code
-rw-r--r--src/microhttpd/connection.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index e49bfe9a..0d7ba27b 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -4234,6 +4234,17 @@ MHD_queue_response (struct MHD_Connection *connection,
4234 return MHD_NO; 4234 return MHD_NO;
4235 } 4235 }
4236#endif /* UPGRADE_SUPPORT */ 4236#endif /* UPGRADE_SUPPORT */
4237 if ( (100 > (status_code & (~MHD_ICY_FLAG))) ||
4238 (999 < (status_code & (~MHD_ICY_FLAG))) )
4239 {
4240#ifdef HAVE_MESSAGES
4241 MHD_DLOG (daemon,
4242 _ ("Refused wrong status code (%u). " \
4243 "HTTP required three digits status code!\n"),
4244 (status_code & (~MHD_ICY_FLAG)));
4245#endif
4246 return MHD_NO;
4247 }
4237 MHD_increment_response_rc (response); 4248 MHD_increment_response_rc (response);
4238 connection->response = response; 4249 connection->response = response;
4239 connection->responseCode = status_code; 4250 connection->responseCode = status_code;