iomenu

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

commit afbe8d1e4630f1e1ca5f55d8f2a61ef63956494c
parent 972969f0568ff78ac41d72a942440859af004ad2
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed,  1 Nov 2017 17:15:48 +0100

buffer.c: off by one

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

diff --git a/buffer.c b/buffer.c @@ -50,17 +50,17 @@ split_lines(char *buf) linec++; if (!linec) linec = 1; - if (!(lv = linev = calloc(linec, sizeof (char **)))) + if (!(lv = linev = calloc(linec + 1, sizeof (char **)))) die("calloc"); - if (!(mv = matchv = calloc(linec, sizeof (char **)))) { + if (!(mv = matchv = calloc(linec + 1, sizeof (char **)))) { free(linev); die("calloc"); } *mv = *lv = b = buf; while ((b = strchr(b, '\n'))) { - *b++ = '\0'; + *b = '\0'; mv++, lv++; - *mv = *lv = b; + *mv = *lv = ++b; } }