iomenu

interactive text selection menu
Log | Files | Refs | README | LICENSE

commit e5026f5e15dba1cd072196edf8a1ead240ab4b2c
parent e3bca30c0b12f79deb675e0e7bd36917226e3dff
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri,  8 Dec 2017 10:18:13 +0100

prevent off by 1

Diffstat:
Miomenu.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/iomenu.c b/iomenu.c @@ -75,9 +75,9 @@ split_lines(char *buf) linec = 1; for (b = buf; (b = strchr(b, '\n')) != NULL && b[1] != '\0'; b++) linec++; - if ((lv = linev = calloc(linec, sizeof (char **))) == NULL) + if ((lv = linev = calloc(linec + 1, sizeof (char **))) == NULL) die("calloc"); - if ((mv = matchv = calloc(linec, sizeof (char **))) == NULL) + if ((mv = matchv = calloc(linec + 1, sizeof (char **))) == NULL) die("calloc"); *mv = *lv = b = buf; while ((b = strchr(b, '\n')) != NULL) {