Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / String / String.cpp
diff options
context:
space:
mode:
1 files changed, 2 insertions, 2 deletions
-rw-r--r--src/Generic/String/String.cpp4
diff --git a/src/Generic/String/String.cpp b/src/Generic/String/String.cpp
index 6b50c64..96a2ca9 100644
--- a/src/Generic/String/String.cpp
+++ b/src/Generic/String/String.cpp
@@ -70,12 +70,12 @@ String& String::operator=(String&& other) {
void String::read(std::istream& istr) {
istr.read((char*)&length, sizeof(length));
- istr.read(str, sizeof(char) * length);
+ istr.read(str, sizeof(char) * (length + 1));
}
void String::write(std::ostream& ostr) const {
ostr.write((char*)&length, sizeof(length));
- ostr.write(str, sizeof(char) * length);
+ ostr.write(str, sizeof(char) * (length + 1));
}
int String::compare(const String& other) const {