ncurses/FORTIFY_SOURCE_3-fix.patch

14 lines
449 B
Diff
Raw Normal View History

diff --git a/ncurses/widechar/lib_unget_wch.c b/ncurses/widechar/lib_unget_wch.c
index 4ea26b6..df82974 100644
--- a/ncurses/widechar/lib_unget_wch.c
+++ b/ncurses/widechar/lib_unget_wch.c
@@ -76,6 +76,8 @@ NCURSES_SP_NAME(unget_wch) (NCURSES_SP_DCLx const wchar_t wch)
init_mb(state);
length = _nc_wcrtomb(0, wch, &state);
+ if (length < MB_CUR_MAX)
+ length = MB_CUR_MAX;
if (length != (size_t) (-1)
&& length != 0) {