Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

sxiv cannot handle filenames with newlines in input mode #445

Open
ykonstant1 opened this issue Apr 11, 2021 · 1 comment
Open

sxiv cannot handle filenames with newlines in input mode #445

ykonstant1 opened this issue Apr 11, 2021 · 1 comment

Comments

@ykonstant1
Copy link

ykonstant1 commented Apr 11, 2021

Affected system: any linux system

Description: Suppose your current directory contains a file with newline, such as $'hello\nworld.jpg'. A command such as find . -name "*.jpg" | sxiv -i will then fail, as sxiv interprets the above file as two separate inputs.

In the same manner, sxiv -o returns a newline-terminated list of files, which will cause problems for further processing in the above scenario. This is a very common trap with unix filenames, and can lead to serious security issues.

Suggestion: Tools like find and xargs include a -0 and -print0 option to return path lists as null terminated strings. My suggestion is to add a -0 option in sxiv with -i in order to accept a list of null-terminated pathnames, rather than newline-terminated. Similarly, add a -print0 option to return null-terminated output.

This will prevent breakage due to unusual filenames and make sxiv compatible with find, xargs etc.

@N-R-K
Copy link

N-R-K commented Sep 21, 2021

Hi @ykonstant1

We've implemented -0 for outputting NULL separated list on nsxiv. However option for NULL seperated input can be done easily via xargs -0 so that will not be added.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants