util/AllocatedString: fix off-by-one bug in Duplicate()
This commit is contained in:
parent
6f41791ea6
commit
e31cdf0df9
@ -90,7 +90,7 @@ public:
|
|||||||
|
|
||||||
static AllocatedString Duplicate(const_pointer begin,
|
static AllocatedString Duplicate(const_pointer begin,
|
||||||
size_t length) {
|
size_t length) {
|
||||||
auto p = new value_type[length];
|
auto p = new value_type[length + 1];
|
||||||
*std::copy_n(begin, length, p) = SENTINEL;
|
*std::copy_n(begin, length, p) = SENTINEL;
|
||||||
return Donate(p);
|
return Donate(p);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user