From ca1e007a225e1e4c6e8f8da556d1f0e1eef87929 Mon Sep 17 00:00:00 2001 From: guoshichao Date: Thu, 25 Apr 2024 17:40:43 +0800 Subject: [PATCH] wchar/lib_ungetwc: fix the array access out of bounds error Signed-off-by: guoshichao --- libs/libc/stdio/lib_ungetwc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libc/stdio/lib_ungetwc.c b/libs/libc/stdio/lib_ungetwc.c index d9f81c6d17e..d3ea7bc53b1 100644 --- a/libs/libc/stdio/lib_ungetwc.c +++ b/libs/libc/stdio/lib_ungetwc.c @@ -70,7 +70,7 @@ wint_t ungetwc_unlocked(wint_t wc, FAR FILE *f) /* Try conversion early so we can fail without locking if invalid */ - if ((l = wctomb(mbc, wc)) < 0) + if ((l = wctomb(mbc, wc)) <= 0) { return WEOF; }