diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-17 19:23:14 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-17 19:23:14 +0000 |
commit | c445c62b4d6488ddeefb27e587d3684f7b94e49b (patch) | |
tree | 23371107b6cba130ec60315d2a83abcc5eeb1f73 | |
parent | Fix leak error with sanitizer in play (diff) | |
download | icespider-c445c62b4d6488ddeefb27e587d3684f7b94e49b.tar.bz2 icespider-c445c62b4d6488ddeefb27e587d3684f7b94e49b.tar.xz icespider-c445c62b4d6488ddeefb27e587d3684f7b94e49b.zip |
Bail early if accept header is empty or all WS
-rw-r--r-- | icespider/core/ihttpRequest.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/icespider/core/ihttpRequest.cpp b/icespider/core/ihttpRequest.cpp index 75b050a..025509f 100644 --- a/icespider/core/ihttpRequest.cpp +++ b/icespider/core/ihttpRequest.cpp @@ -37,6 +37,10 @@ namespace IceSpider { Accepted IHttpRequest::parseAccept(const std::string_view & acceptHdr) { + if (acceptHdr.empty() + || std::find_if_not(acceptHdr.begin(), acceptHdr.end(), std::iswspace) == acceptHdr.end()) { + throw Http400_BadRequest(); + } auto accept = std::unique_ptr<FILE, decltype(&fclose)>( fmemopen(const_cast<char *>(acceptHdr.data()), acceptHdr.length(), "r"), &fclose); Accepted accepts; |