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>
This commit is contained in:
Miika Turkia 2014-12-07 21:36:54 +02:00 committed by Dirk Hohndel
parent 19c75b878c
commit 5831af3fe2

2
file.c
View file

@ -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;