sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 22f40b5a03bf9c1a73cc325922bdbe147d6de7c3
parent 986a9de51a77e7f6803e1b2259ec0675762077db
Author: FRIGN <dev@frign.de>
Date:   Sun,  1 Feb 2015 04:20:02 +0100

Add explicit boundary to loop in readrune()

You never know what could happen. Better have a "blind" read than
a segmentation fault.

Diffstat:
Mlibutf/readrune.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libutf/readrune.c b/libutf/readrune.c @@ -27,7 +27,7 @@ readrune(const char *file, FILE *fp, Rune *r) } buf[0] = c; - for (i = 1; ;) { + for (i = 1; i < UTFmax; ) { if ((c = fgetc(fp)) == EOF) { if (ferror(fp)) { fprintf(stderr, "%s: read error: %s\n",