StatusLine::parse: only feed integers to std::atoi()
Signed-off-by: Miklos Vajna <vmiklos@collabora.com> Change-Id: I7591fd14fbdc7c1210ac8141cb78854e3f20fffdpull/2122/head
parent
9e331465d9
commit
415a834813
|
@ -0,0 +1,2 @@
|
|||
HTTP/1.1
|
||||
|
|
@ -225,6 +225,11 @@ FieldParseState StatusLine::parse(const char* p, int64_t& len)
|
|||
|
||||
// Read the Status Code now.
|
||||
assert(off + StatusCodeLen < len && "Expected to have more data.");
|
||||
if (p[off] < '0' || p[off] > '9')
|
||||
{
|
||||
LOG_ERR("StatusLine::parse: expected valid integer number");
|
||||
return FieldParseState::Invalid;
|
||||
}
|
||||
_statusCode = std::atoi(&p[off]);
|
||||
if (_statusCode < MinValidStatusCode || _statusCode > MaxValidStatusCode)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue