From e31cdf0df9604450f5b5a34ab43877f22479236c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 1 Sep 2015 23:33:19 +0200 Subject: [PATCH] util/AllocatedString: fix off-by-one bug in Duplicate() --- src/util/AllocatedString.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/AllocatedString.hxx b/src/util/AllocatedString.hxx index e01955381..01eefac8a 100644 --- a/src/util/AllocatedString.hxx +++ b/src/util/AllocatedString.hxx @@ -90,7 +90,7 @@ public: static AllocatedString Duplicate(const_pointer begin, size_t length) { - auto p = new value_type[length]; + auto p = new value_type[length + 1]; *std::copy_n(begin, length, p) = SENTINEL; return Donate(p); }