Loading src/html.cpp +21 −4 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ namespace libhtmlpp { "span", "frame", "iframe", "textarea", nullptr }; Loading Loading @@ -1237,21 +1238,37 @@ void libhtmlpp::HtmlPage::_CheckHeader(const HtmlString &page){ const char typevalue[] = { 'h','t','m','l' }; size_t tpvl = 4; const char typevalue4[] = {'H','T','M','L',' ','P','U','B','L','I','C'}; size_t tpvl4 = 11; if ((i + tpvl) > page.size()) { HTMLException excp; excp[HTMLException::Critical] << "Doctype header broken or wrong type"; throw excp; } int ii = 0,ie=i+tpvl; int ii = 0,ie=i+tpvl,oldpos=i; while (i < ie) { if (page[i] != typevalue[ii]) { i=oldpos; if ((i + tpvl4) > page.size()) { HTMLException excp; excp[HTMLException::Critical] << "Doctype header broken or wrong type"; throw excp; } int ii4 = 0,ie4=i+tpvl4; while (i < ie4) { if(page[i] != typevalue4[ii4]){ HTMLException excp; excp[HTMLException::Critical] << "wrong Doctype"; throw excp; } ++i; ++ii4; } } ++i; ++ii; } } Loading Loading
src/html.cpp +21 −4 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ namespace libhtmlpp { "span", "frame", "iframe", "textarea", nullptr }; Loading Loading @@ -1237,21 +1238,37 @@ void libhtmlpp::HtmlPage::_CheckHeader(const HtmlString &page){ const char typevalue[] = { 'h','t','m','l' }; size_t tpvl = 4; const char typevalue4[] = {'H','T','M','L',' ','P','U','B','L','I','C'}; size_t tpvl4 = 11; if ((i + tpvl) > page.size()) { HTMLException excp; excp[HTMLException::Critical] << "Doctype header broken or wrong type"; throw excp; } int ii = 0,ie=i+tpvl; int ii = 0,ie=i+tpvl,oldpos=i; while (i < ie) { if (page[i] != typevalue[ii]) { i=oldpos; if ((i + tpvl4) > page.size()) { HTMLException excp; excp[HTMLException::Critical] << "Doctype header broken or wrong type"; throw excp; } int ii4 = 0,ie4=i+tpvl4; while (i < ie4) { if(page[i] != typevalue4[ii4]){ HTMLException excp; excp[HTMLException::Critical] << "wrong Doctype"; throw excp; } ++i; ++ii4; } } ++i; ++ii; } } Loading