commit 38da7cce4bb3534cea4488157e08ac80987885bf
Author: FRIGN <[email protected]>
Date:   Sun Feb 1 04:20:02 2015 +0100

    Add explicit boundary to loop in readrune()
    
    You never know what could happen. Better have a "blind" read than
    a segmentation fault.

diff --git a/libutf/readrune.c b/libutf/readrune.c
index 8bab478..3fda9ef 100644
--- 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",

Reply via email to