Merge pull request #140 from ledyba/check_data_len

you have to check len before accsessing "p".
This commit is contained in:
Lee Thomason 2013-11-05 10:52:04 -08:00
commit 370761b179
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;