[hackers] [PATCH 2/2] strings: treat Runeerror as nonprintable

From: Brad Barden <b+suckless_AT_13os.net>
Date: Sun, 21 Nov 2021 13:58:11 +0000

bytes which aren't valid runes are not part of a sequence of printable
characters and shouldn't be skipped over.
---
 strings.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/strings.c b/strings.c
index da25f9f..930d4cc 100644
--- a/strings.c
+++ b/strings.c
_AT_@ -20,9 +20,7 @@ strings(FILE *fp, const char *fname, size_t min)
 
 	for (off = 0, start = 0, i = 0; (bread = efgetrune(&r, fp, fname)); ) {
 		off += bread;
-		if (r == Runeerror)
-			continue;
-		if (!isprintrune(r)) {
+		if (r == Runeerror || !isprintrune(r)) {
 			if (i == min)
 				putchar('\n');
 			start = off;
-- 
2.31.1
Received on Sun Nov 21 2021 - 14:58:11 CET

This archive was generated by hypermail 2.3.0 : Sun Nov 21 2021 - 15:36:38 CET