fix fgetwc when decoding a character that crosses buffer boundary
authorSzabolcs Nagy <nsz@port70.net>
Sat, 18 Nov 2017 16:51:48 +0000 (17:51 +0100)
committerRich Felker <dalias@aerifal.cx>
Sun, 19 Nov 2017 01:11:08 +0000 (20:11 -0500)
Update the buffer position according to the bytes consumed into st when
decoding an incomplete character at the end of the buffer.

src/stdio/fgetwc.c

index e455cfec408bc101c7c15077e68d45f4491e3395..a00c1a862babf2b0732909b77ce765cc31655888 100644 (file)
@@ -22,6 +22,7 @@ static wint_t __fgetwc_unlocked_internal(FILE *f)
                        f->rpos++;
                        return WEOF;
                }
+               f->rpos = f->rend;
        } else l = -2;
 
        /* Convert character byte-by-byte */