summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-12 01:32:25 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-12 01:32:25 -0700
commit99afee183225f6f33f3289030c992738ccaf13fe (patch)
tree12026f4b10984a780a5cddea2df5c5a1f131dfaf
parent3da7d68617d196d76b56cff27ad565f64f87d476 (diff)
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.
-rw-r--r--src/pugixml.cpp6
1 files 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;
}