readline/readline-8.3-sast.patch
Siteshwar Vashisht 99b65aa73c Fix issues identified by OpenScanHub
Resolves: RHEL-44656

Signed-off-by: Siteshwar Vashisht <svashisht@redhat.com>
2024-08-29 12:34:40 +02:00

29 lines
742 B
Diff

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)