mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-27 00:30:26 +00:00
Fix potential out-of-bounds access.
This commit is contained in:
parent
e650f3772a
commit
0d0e1083e6
@ -59,7 +59,7 @@ void Typer::append(const std::string &string) {
|
|||||||
// If the final character in the string is not Typer::EndString
|
// If the final character in the string is not Typer::EndString
|
||||||
// then this machine doesn't need Begin and End, so don't worry about it.
|
// then this machine doesn't need Begin and End, so don't worry about it.
|
||||||
ssize_t insertion_position = ssize_t(string_.size());
|
ssize_t insertion_position = ssize_t(string_.size());
|
||||||
if(string_.back() == Typer::EndString) --insertion_position;
|
if(!string_.empty() && string_.back() == Typer::EndString) --insertion_position;
|
||||||
|
|
||||||
string_.reserve(string_.size() + string.size());
|
string_.reserve(string_.size() + string.size());
|
||||||
for(const char c : string) {
|
for(const char c : string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user