Message ID | ZmVlfDqLvvfdw51t@gondor.apana.org.au (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | parser: Fix PEOF infinite loop in getmbc | expand |
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;
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@gondor.apana.org.au> --- src/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)