String line;
StreamReadStatus srs = m_Stream->ReadLine(&line, src, may_wait);
- if (srs != StatusNewItem)
+ if (srs != StatusNewItem) {
+ if (src.Size > 512)
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Line length for HTTP header exceeded"));
+
return false;
+ }
+
+ if (line.GetLength() > 512)
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Line length for HTTP header exceeded"));
if (m_State == HttpRequestStart) {
/* ignore trailing new-lines */
return true;
} else {
+ if (Headers->GetLength() > 128)
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Maximum number of HTTP request headers exceeded"));
+
String::SizeType pos = line.FindFirstOf(":");
if (pos == String::NPos)
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid HTTP request"));