summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/files.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r--crawl-ref/source/files.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index cdfd51895a..ad55283bfc 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1648,10 +1648,9 @@ std::string readString(FILE *file, int cap)
{
if (length <= cap)
{
- char *buf = new char[length + 1];
+ char *buf = new char[length];
read2(file, buf, length);
- buf[length] = 0;
- const std::string s = buf;
+ const std::string s(buf, length);
delete [] buf;
return (s);
}