aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools/map_extractor/System.cpp2
-rw-r--r--src/tools/map_extractor/mpq_libmpq04.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index 2173dab4e1c..a44c6f00acb 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -186,7 +186,7 @@ uint32 ReadBuild(int locale)
exit(1);
}
- std::string text = m.getPointer();
+ std::string text = std::string(m.getPointer(), m.getSize());
m.close();
size_t pos = text.find("version=\"");
diff --git a/src/tools/map_extractor/mpq_libmpq04.h b/src/tools/map_extractor/mpq_libmpq04.h
index 4691693d80d..a4eaf1d42db 100644
--- a/src/tools/map_extractor/mpq_libmpq04.h
+++ b/src/tools/map_extractor/mpq_libmpq04.h
@@ -27,7 +27,8 @@ public:
libmpq__off_t size, transferred;
libmpq__file_unpacked_size(mpq_a, filenum, &size);
- char *buffer = new char[size];
+ char *buffer = new char[size+1];
+ buffer[size] = '\0';
libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred);