fix overread (consuming an extra byte) scanning NAN

bug detected by glib test suite
This commit is contained in:
Rich Felker
2012-04-21 11:57:39 -04:00
parent c613125966
commit 33e7781b5b

View File

@ -436,7 +436,7 @@ long double __floatscan(FILE *f, int prec, int pok)
return sign * INFINITY;
}
if (!i) for (i=0; i<3 && (c|32)=="nan"[i]; i++)
if (i<3) c = shgetc(f);
if (i<2) c = shgetc(f);
if (i==3) {
return NAN;
}