diff --git a/src/kit/shell/src/shellLinux.c b/src/kit/shell/src/shellLinux.c index 84437389efe5a95e5626e830940ef3ce07fe837e..7190070238774572b7a8df147a0264725c0734f8 100644 --- a/src/kit/shell/src/shellLinux.c +++ b/src/kit/shell/src/shellLinux.c @@ -312,7 +312,12 @@ void shellPrintNChar(char *str, int width, bool printMode) { if (*str == '\0') break; char *tstr = str; int byte_width = mbtowc(&wc, tstr, MB_CUR_MAX); + if (byte_width <= 0 ) break; int col_width = wcwidth(wc); + if (col_width <= 0) { + str += byte_width; + continue; + } if (col_left < col_width) break; printf("%lc", wc); str += byte_width;