lib/file: Fix issue #71 - Electric Boogaloo (Out of bounds access)

Add size constraint to make sure string terminates at the correct
length. Cygwin appears to not put null bytes to terminate string when
reading from a file stream.
windows
Shwoomple 2022-11-12 11:51:43 +05:30
parent 9bda607649
commit bc2255de6b
1 changed files with 1 additions and 1 deletions

View File

@ -225,7 +225,7 @@ ErrorOrVoid File::insertString(tiny_utf8::string string){
this->fileStream.read(reinterpret_cast<char*>(buffer), this->size.value);
readData = tiny_utf8::string((char *) buffer);
readData = tiny_utf8::string((char *) buffer, 0, this->size.value);
readData.insert(readData.begin()+this->cursorPosition, string);
this->fileStream.seekg(0);