you have to check len before accsessing "p".

This commit is contained in:
psi 2013-11-03 10:54:33 +09:00
parent e1979a883b
commit 690ba07bda
1 changed files with 5 additions and 0 deletions

View File

@ -1702,6 +1702,11 @@ XMLError XMLDocument::Parse( const char* p, size_t len )
const char* start = p; const char* start = p;
Clear(); Clear();
if ( len == 0 ) {
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
return _errorID;
}
if ( !p || !*p ) { if ( !p || !*p ) {
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
return _errorID; return _errorID;