Bail out of getmbc if the first character is PEOF. Fixes: 6c44f4ee0c2b ("parser: Add support for multi-byte characters") Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> --- src/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.c b/src/parser.c index a4d3291..3d21894 100644 --- a/src/parser.c +++ b/src/parser.c @@ -892,7 +892,7 @@ unsigned getmbc(int c, char *out, int mode) wchar_t wc; char *mbc; - if (likely(c >= 0)) + if (likely(c >= 0 || c <= PEOF)) return 0; mbc = (mode & 3) < 2 ? out + 2 + (mode == 1) : out; -- 2.39.2 -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt