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:
parent
986a9de51a
commit
22f40b5a03
|
@ -27,7 +27,7 @@ readrune(const char *file, FILE *fp, Rune *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[0] = c;
|
buf[0] = c;
|
||||||
for (i = 1; ;) {
|
for (i = 1; i < UTFmax; ) {
|
||||||
if ((c = fgetc(fp)) == EOF) {
|
if ((c = fgetc(fp)) == EOF) {
|
||||||
if (ferror(fp)) {
|
if (ferror(fp)) {
|
||||||
fprintf(stderr, "%s: read error: %s\n",
|
fprintf(stderr, "%s: read error: %s\n",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user