commit 42b8177efc1ac7c8c80ecda7b13577d9f67bf151
parent e8b9e63c0e2eb0ad86b212e16d3c8b5fcbf4c3c2
Author: Claudio Alessi <smoppy@gmail.com>
Date: Mon, 29 Feb 2016 19:32:20 +0100
Fix records() table name string size.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/core.c b/core.c
@@ -270,7 +270,7 @@ stfl_putitem(Item *item) {
else {
strncpy(txt, "listitem text:\"", sizeof txt);
for(int i = 0; i < item->nfields; ++i) {
- snprintf(t, sizeof t, "%8.16s", item->fields[i]);
+ snprintf(t, sizeof t, "%-8.16s", item->fields[i]);
if(i)
strncat(txt, " | ", sizeof txt);
/* XXX What if strlen(all_fields) > sizeof txt? */
@@ -325,7 +325,7 @@ void
records(void) {
Item *item;
MYSQL_RES *res;
- char t[32]; /* XXX */
+ char t[64 + 16]; /* MySQL max table name length is 64. */
snprintf(t, sizeof t, "select * from `%s`", selitem->fields[0]);
if(!(res = mysql_exec(t)))