From ec77d776db91339343939c0d78fd190f78524b10 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 20 Apr 2017 21:23:16 +0000 Subject: [PATCH] control_char() for ASCII needs to include both genuine control characters and top-bit-set nonprintable characters (so both iscntrl() and !isprint()), fixes behaviour broken in r1.15/r1.16, noticed by deraadt@. ok deraadt tedu --- usr.bin/less/charset.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/less/charset.c b/usr.bin/less/charset.c index 73c7a17da9d..4c8db50d553 100644 --- a/usr.bin/less/charset.c +++ b/usr.bin/less/charset.c @@ -164,7 +164,9 @@ int control_char(LWCHAR c) { c &= 0377; - return (iscntrl((unsigned char)c)); + if (utf_mode) + return (iscntrl((unsigned char)c)); + return (iscntrl((unsigned char)c) || !isprint((unsigned char)c)); } /* -- 2.20.1