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

sxiv cannot handle filenames with newlines in input mode #445

Description

@ykonstant1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions