summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-12-07 21:36:54 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-08 08:49:12 -0800
commit5831af3fe22f2143d34421d0918bd1140b93b599 (patch)
tree4e58cb5dd64e731c82778fae3f2abde569eb12ee /file.c
parent19c75b878cbe0070c56dfa277ba3f9026b9d41b9 (diff)
downloadsubsurface-5831af3fe22f2143d34421d0918bd1140b93b599.tar.gz
Fix a crash on CSV import
Seems that there was not enough space reserved for the whole mem buffer when adding XML tags around CSV file. When unlucky, the metadata of memory allocation was overwritten. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r--file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/file.c b/file.c
index d733613f1..d85661080 100644
--- a/file.c
+++ b/file.c
@@ -116,7 +116,7 @@ static int try_to_xslt_open_csv(const char *filename, struct memblock *mem, cons
*
* Tag markers take: strlen("<></>") = 5
*/
- buf = realloc(mem->buffer, mem->size + 5 + strlen(tag) * 2);
+ buf = realloc(mem->buffer, mem->size + 6 + strlen(tag) * 2);
if (buf != NULL) {
char *starttag = NULL;
char *endtag = NULL;