提交 39d0226b 编写于 作者: wmmhello's avatar wmmhello

fix dead loop if shell character is invalidate

上级 b62d3759
......@@ -565,9 +565,12 @@ static void shellPrintNChar(const char *str, int length, int width) {
if (bytes <= 0) {
break;
}
if (pos + bytes > length) {
break;
}
int w = 0;
#ifdef WINDOWS
w = bytes;
w = bytes;gdn
#else
if(*(str + pos) == '\t' || *(str + pos) == '\n' || *(str + pos) == '\r'){
w = bytes;
......@@ -575,15 +578,11 @@ static void shellPrintNChar(const char *str, int length, int width) {
w = wcwidth(wc);
}
#endif
pos += bytes;
if (w <= 0) {
continue;
}
pos += bytes;
if (pos > length) {
break;
}
if (width <= 0) {
printf("%lc", wc);
continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册