From 615ffa7ac36cba37b0ff3e4c960de5f0dd149be8 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 7 Dec 2006 12:06:28 +0000 Subject: [1610689] Fixed string unmarshall being off by one. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@591 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/tags.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/tags.cc') 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); -- cgit v1.2.3-54-g00ecf