diff -Nru less-590/debian/patches/0003-update-filename.c.patch less-590/debian/patches/0003-update-filename.c.patch --- less-590/debian/patches/0003-update-filename.c.patch 1970-01-01 08:00:00.000000000 +0800 +++ less-590/debian/patches/0003-update-filename.c.patch 2024-01-24 10:01:50.000000000 +0800 @@ -0,0 +1,47 @@ +From: lvpeng <14846406+lvpeng861@user.noreply.gitee.com> +Date: Mon, 2 Dec 2024 01:46:37 +0000 +Subject: update filename.c. + +Signed-off-by: lvpeng <14846406+lvpeng861@user.noreply.gitee.com> +--- + filename.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/filename.c b/filename.c +index aba8d3a..a773825 100644 +--- a/filename.c ++++ b/filename.c +@@ -477,7 +477,7 @@ bin_file(f) + edata = &data[n]; + for (p = data; p < edata; ) + { +- if (utf_mode && !is_utf8_well_formed(p, edata-data)) ++ if (utf_mode && !is_utf8_well_formed(p, edata-p)) + { + bin_count++; + utf_skip_to_lead(&p, edata); +@@ -971,6 +971,8 @@ close_altfile(altfilename, filename) + { + #if HAVE_POPEN + char *lessclose; ++ char *qfilename; ++ char *qaltfilename; + FILE *fd; + char *cmd; + int len; +@@ -985,9 +987,13 @@ close_altfile(altfilename, filename) + error("LESSCLOSE ignored; must contain no more than 2 %%s", NULL_PARG); + return; + } +- len = (int) (strlen(lessclose) + strlen(filename) + strlen(altfilename) + 2); ++ qfilename = shell_quote(filename); ++ qaltfilename = shell_quote(altfilename); ++ len = (int) (strlen(lessclose) + strlen(qfilename) + strlen(qaltfilename) + 2); + cmd = (char *) ecalloc(len, sizeof(char)); +- SNPRINTF2(cmd, len, lessclose, filename, altfilename); ++ SNPRINTF2(cmd, len, lessclose, qfilename, qaltfilename); ++ free(qaltfilename); ++ free(qfilename); + fd = shellcmd(cmd); + free(cmd); + if (fd != NULL) diff -Nru less-590/debian/patches/series less-590/debian/patches/series --- less-590/debian/patches/series 2024-01-24 10:01:50.000000000 +0800 +++ less-590/debian/patches/series 2024-01-24 10:01:50.000000000 +0800 @@ -1,2 +1,3 @@ less-is-more-434417.patch 02-655926-more_can_go_backwards.patch +0003-update-filename.c.patch