From 06b1fcad13758750bea4b8604e364af861afa938 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 24 Apr 2016 21:44:11 +0200
Subject: [PATCH] tabbing: fix erroneous use of strnlenpt()

Names could be strings of multibyte characters, so they could be more
than COLS - 1 bytes long and still be less than COLS - 1 columns wide.
---
 src/files.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/files.c b/src/files.c
index 314b064b..2dff2acd 100644
--- a/src/files.c
+++ b/src/files.c
@@ -2848,7 +2848,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
 
 	    /* Find the length of the longest among the choices. */
 	    for (match = 0; match < num_matches; match++) {
-		size_t namelen = strnlenpt(matches[match], COLS - 1);
+		size_t namelen = strlenpt(matches[match]);
 
 		if (namelen > longest_name)
 		    longest_name = namelen;
-- 
GitLab