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

Unsanitised pattern input to string.gsub #131

Open
Danie-1 opened this issue Jun 16, 2024 · 0 comments
Open

Unsanitised pattern input to string.gsub #131

Danie-1 opened this issue Jun 16, 2024 · 0 comments

Comments

@Danie-1
Copy link
Contributor

Danie-1 commented Jun 16, 2024

When running tex4ebook with the option -B "epub-build" I got an error saying "attempt to index a nil value".

The root cause is in tex4ebook-exec_epub.lua, in the function remove_builddir, where a call is made to string.gsub with unsanitised user input:

return filename:gsub("^" .. builddir .. "/", "")

In this particular case, the cause is that "-" is a special character for lua patterns, so the pattern "^epub-build/" does not match for strings which start with "epub-build/". I will try to submit a pull request with a suggested fix soon.

Danie-1 added a commit to Danie-1/tex4ebook that referenced this issue Jun 16, 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

1 participant