nghttpx: Check max length of ALPN field

This commit is contained in:
Tatsuhiro Tsujikawa 2014-11-14 23:19:16 +09:00
parent 5ce8ae79f0
commit a2bc88f6db
1 changed files with 5 additions and 0 deletions

View File

@ -99,6 +99,11 @@ std::vector<unsigned char> set_alpn_prefs(const std::vector<char*>& protos)
len += 1 + n;
}
if(len > (1 << 16) - 1) {
LOG(FATAL) << "Too long ALPN identifier list: " << len;
DIE();
}
auto out = std::vector<unsigned char>(len);
auto ptr = out.data();