summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/tags.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 0d4b507aaa..007702870f 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -313,8 +313,8 @@ void unmarshallString(struct tagHeader &th, char *data, int maxSize)
// get length
short len = unmarshallShort(th);
int copylen = len;
- if (len > maxSize && maxSize > 0)
- copylen = maxSize;
+ if (len >= maxSize && maxSize > 0)
+ copylen = maxSize - 1;
// read the actual string and null terminate
memcpy(data, &tagBuffer[th.offset], copylen);