Page MenuHome GnuPG

GNUPGHOME with newlines breaks standard parsing of gpgconf --list-dirs
Closed, ResolvedPublic

Description

try:

    GNUPGHOME=$(printf "/tmp/foo\nbar") gpgconf --list-dirs

the result is that someone parsing the output will get "/tmp/foo" and will think
that there is an new gnupg directory named "bar" (with no value).

as field separators, colons are escaped, but i think newlines (as record
separators) should also be escaped.

Event Timeline

Quite obvious. There are probably a lot of other places which will fail with a
LF in a file name. What do you think of detecting such strange directory names
early and bail out with a fatal error?

We could bail early if we see something like this.

But since percent-unescaping is supposed to be able to handle arbitrary
characters (and consumers of this data have to percent-unescape anyway), why not
escape the record separator instead of bailing?

I fear that a LF yields other problems as well. However, the percent escaping
woyld make it easier to find.

werner raised the priority of this task from Low to Normal.Jan 6 2017, 5:29 PM
werner added a project: gnupg (gpg22).