diff --git a/src/files.c b/src/files.c
index 314b064b085950efd97e3d9d0cc0db51f786aa21..2dff2acdbc1e7e173e3d03ebc9de215577363295 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;