From 8f49e98a3fe27022c08b311a6455cdf0c3fb5525 Mon Sep 17 00:00:00 2001 From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] 0049-proc/escape.c: Handle negative wcwidth() return value. This should never happen, because wcwidth() is called only if iswprint() returns nonzero. But belt-and-suspenders, and make it visually clear (very important for the next patch). --- proc/escape.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc/escape.c b/proc/escape.c index 62123530..114860af 100644 --- a/proc/escape.c +++ b/proc/escape.c @@ -90,7 +90,7 @@ static int escape_str_utf8(char *restrict dst, const char *restrict src, int buf /* multibyte - printable */ int wlen = wcwidth(wc); - if (wlen==0) { + if (wlen<=0) { // invisible multibyte -- we don't ignore it, because some terminal // interpret it wrong and more safe is replace it with '?' *(dst++) = '?';