readline/readline-8.3-sast.patch

29 lines
742 B
Diff
Raw Normal View History

diff --git a/text.c b/text.c
--- a/text.c
+++ b/text.c
@@ -1409,8 +1409,7 @@ rl_change_case (int count, int op)
#if defined (HANDLE_MULTIBYTE)
WCHAR_T wc, nwc;
char mb[MB_LEN_MAX+1];
- int mlen;
- size_t m;
+ size_t m, mlen;
mbstate_t mps;
#endif
@@ -1479,12 +1478,12 @@ rl_change_case (int count, int op)
memset (&ts, 0, sizeof (mbstate_t));
mlen = WCRTOMB (mb, nwc, &ts);
- if (mlen < 0)
+ if (MB_INVALIDCH (mlen))
{
nwc = wc;
memset (&ts, 0, sizeof (mbstate_t));
mlen = WCRTOMB (mb, nwc, &ts);
- if (mlen < 0) /* should not happen */
+ if (MB_INVALIDCH (mlen)) /* should not happen */
strncpy (mb, rl_line_buffer + start, mlen = m);
}
if (mlen > 0)