commit 931910ad6c747b53d8b14214da518117dcd2ca33
parent 4ee4c4f7bb7a4a9874c6ab8cca639c3e8d9b2cb3
Author: Claudio Alessi <smoppy@gmail.com>
Date: Thu, 3 Mar 2016 17:37:12 +0100
Fix a terrifying bug introduced by the previous commit.
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/core.c b/core.c
@@ -281,6 +281,7 @@ mysql_items(MYSQL_RES *res, Item **items) {
lens = mysql_fetch_lengths(res);
item->fields = ecalloc(nfds, sizeof(char *));
for(i = 0; i < nfds; ++i) {
+ ++lens[i]; /* Add NUL-byte */
item->fields[i] = ecalloc(lens[i], sizeof(char));
snprintf(item->fields[i], lens[i], "%s", row[i]);
}