Add explicit boundary to loop in readrune()

You never know what could happen. Better have a "blind" read than
a segmentation fault.
This commit is contained in:
FRIGN 2015-02-01 04:20:02 +01:00
parent 986a9de51a
commit 22f40b5a03
1 changed files with 1 additions and 1 deletions

View File

@ -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",