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
parent
9bda607649
commit
bc2255de6b
|
@ -225,7 +225,7 @@ ErrorOrVoid File::insertString(tiny_utf8::string string){
|
||||||
|
|
||||||
this->fileStream.read(reinterpret_cast<char*>(buffer), this->size.value);
|
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);
|
readData.insert(readData.begin()+this->cursorPosition, string);
|
||||||
|
|
||||||
this->fileStream.seekg(0);
|
this->fileStream.seekg(0);
|
||||||
|
|
Loading…
Reference in New Issue