util/AllocatedString: fix off-by-one bug in Duplicate()

This commit is contained in:
Max Kellermann 2015-09-01 23:33:19 +02:00
parent 6f41791ea6
commit e31cdf0df9

View File

@ -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);
}