diff options
author | Werner Koch <[email protected]> | 2020-11-02 16:23:53 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2020-11-02 16:48:39 +0000 |
commit | f007d79533e638e395e1a3cf99233fd900cc805c (patch) | |
tree | 6432217eb1182716557f1e31a31efdafdb46f7bf | |
parent | gpg: Do not use weak digest algos if selected by recipient prefs. (diff) | |
download | gnupg-f007d79533e638e395e1a3cf99233fd900cc805c.tar.gz gnupg-f007d79533e638e395e1a3cf99233fd900cc805c.zip |
gpg: Allow setting notations with the empty string as value.
* g10/misc.c (pct_expando): Catch special case of the empty string.
Also map a NULL to the empty string.
* g10/photoid.c (show_photos): Make an empty string used as command
fail.
--
This patch also fixes a segv when calling gpg wrongly like
gpg -N \[email protected]
GnuPG-bug-id: 5117
Signed-off-by: Werner Koch <[email protected]>
-rw-r--r-- | g10/misc.c | 5 | ||||
-rw-r--r-- | g10/photoid.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/g10/misc.c b/g10/misc.c index 6577bb902..fca071836 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -917,6 +917,11 @@ pct_expando(const char *string,struct expando_args *args) u32 pk_keyid[2]={0,0},sk_keyid[2]={0,0}; char *ret=NULL; + /* The parser below would return NULL for an empty string, thus we + * catch it here. Also catch NULL here. */ + if (!string || !*string) + return xstrdup (""); + if(args->pk) keyid_from_pk(args->pk,pk_keyid); diff --git a/g10/photoid.c b/g10/photoid.c index f9720d329..81ea7a0ca 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -341,6 +341,11 @@ show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count, command=pct_expando(opt.photo_viewer,&args); if(!command) goto fail; + if (!*command) + { + xfree (command); + goto fail; + } name=xmalloc(16+strlen(EXTSEP_S)+ strlen(image_type_to_string(args.imagetype,0))+1); |