bounds check in http headers

This commit is contained in:
Jeff Becker 2020-03-05 18:25:27 -05:00
parent 54b9934b8f
commit e8fd66ba8a
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

View File

@ -13,7 +13,7 @@ namespace abyss
return true; return true;
} }
auto idx = line.find_first_of(':'); auto idx = line.find_first_of(':');
if(idx == string_view::npos) if(idx == string_view::npos || (line.size() - 1) <= (1 + idx))
return false; return false;
string_view header = line.substr(0, idx); string_view header = line.substr(0, idx);
string_view val = line.substr(1 + idx); string_view val = line.substr(1 + idx);