1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

LibC: Fix dumb off-by-two in fgets() :^)

"Play C games, win C prizes."
This commit is contained in:
Andreas Kling 2019-09-22 20:03:02 +02:00
parent 64948fa701
commit edac8704de

View file

@ -108,7 +108,7 @@ char* fgets(char* buffer, int size, FILE* stream)
ASSERT(stream);
ASSERT(size);
ssize_t nread = 0;
while (nread < (size + 1)) {
while (nread < (size - 1)) {
int ch = fgetc(stream);
if (ch == EOF)
break;