From 690ba07bda3157cdea1d449023b982508326ce15 Mon Sep 17 00:00:00 2001 From: psi Date: Sun, 3 Nov 2013 10:54:33 +0900 Subject: [PATCH] you have to check len before accsessing "p". --- tinyxml2.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 040a2a1..7e4ff40 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1702,6 +1702,11 @@ XMLError XMLDocument::Parse( const char* p, size_t len ) const char* start = p; Clear(); + if ( len == 0 ) { + SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); + return _errorID; + } + if ( !p || !*p ) { SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); return _errorID;