Commit bfe7a9af authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttp: Fix crash if attrs parameter of get_attr() is nullptr

parent 59397e80
...@@ -48,12 +48,15 @@ HtmlParser::~HtmlParser() ...@@ -48,12 +48,15 @@ HtmlParser::~HtmlParser()
namespace { namespace {
const char* get_attr(const xmlChar **attrs, const char *name) const char* get_attr(const xmlChar **attrs, const char *name)
{ {
if(attrs == nullptr) {
return nullptr;
}
for(; *attrs; attrs += 2) { for(; *attrs; attrs += 2) {
if(util::strieq(reinterpret_cast<const char*>(attrs[0]), name)) { if(util::strieq(reinterpret_cast<const char*>(attrs[0]), name)) {
return reinterpret_cast<const char*>(attrs[1]); return reinterpret_cast<const char*>(attrs[1]);
} }
} }
return 0; return nullptr;
} }
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment