Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

special characters in filename are not escaped for error messages #503

Closed
vinc17fr opened this issue Apr 22, 2024 · 7 comments
Closed

special characters in filename are not escaped for error messages #503

vinc17fr opened this issue Apr 22, 2024 · 7 comments

Comments

@vinc17fr
Copy link
Contributor

With the current less from Git and previous versions, special characters in filename are not escaped for error messages. This can do bad things in the terminal.

For instance, with a shell that accepts the $'...' syntax (otherwise Ctrl-V should be used to enter the escape character):

$ file=test$'\033'\[\?5h
$ echo foo > "$file"
$ chmod 000 "$file"
$ less "$file"
test: Permission denied

and the terminal is put in reverse video. One can also use test$'\033'\[\?40h$'\033'\[\?3h in a 80-column xterm, which has the effect to resize the terminal to 132 columns.

@vinc17fr
Copy link
Contributor Author

There's also a minor issue when the file is viewable:

$ file=test$'\033'\[\?5hend
$ echo foo > "$file"
$ less -M "$file"
$ less -MR "$file"

With just -M, I get the status line

testESC[?5hend lines 1-1/1 (END)

in reverse video, which is OK. But with -MR, I just get

testend lines 1-1/1 (END)

where only test is in reverse video.

@carnil
Copy link

carnil commented Apr 23, 2024

Cross reference to a downstream report: https://bugs.debian.org/1069681

@gwsw
Copy link
Owner

gwsw commented Apr 23, 2024

Probably fixed in e98b228.
Needs a bit more testing.

@gwsw
Copy link
Owner

gwsw commented Apr 28, 2024

Ok, as far as I can tell, this is fixed.

@carnil
Copy link

carnil commented May 2, 2024

Just for clarity with the above reference: 2a642a0 should be the isolated fix itself.

@IgorTodorovskiIBM
Copy link
Contributor

Do you plan to publish a new version soon? We're seeing the current version flagged with https://nvd.nist.gov/vuln/detail/CVE-2024-32487

@gwsw
Copy link
Owner

gwsw commented May 6, 2024

Yes, less-654 is in beta testing now. If no serious problems turn up, I expect to release it within a couple of weeks.
http:https://greenwoodsoftware.com/less/index.html

@gwsw gwsw closed this as completed May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants