From 99afee183225f6f33f3289030c992738ccaf13fe Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sun, 12 Apr 2015 01:32:25 -0700 Subject: Move zero-termination out of as_utf8_end as_utf8_end was used with std::string, where writing an extra zero-terminating character should *probably* always work (at least if size is positive) but is not ideal. The only place that needed to zero-terminate was convert_path_heap. --- src/pugixml.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 5190937..6b3e87e 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -1691,9 +1691,6 @@ PUGI__NS_BEGIN assert(begin + size == end); (void)!end; - - // zero-terminate - buffer[size] = 0; } #ifndef PUGIXML_NO_STL @@ -4295,6 +4292,9 @@ PUGI__NS_BEGIN // second pass: convert to utf8 as_utf8_end(result, size, str, length); + // zero-terminate + result[size] = 0; + return result; } -- cgit v1.2.3