mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
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 \-foo@example.org GnuPG-bug-id: 5117 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
6397cf5fbe
commit
e1bafa3574
@ -922,6 +922,11 @@ pct_expando (ctrl_t ctrl, const char *string,struct expando_args *args)
|
|||||||
u32 pk_keyid[2]={0,0},sk_keyid[2]={0,0};
|
u32 pk_keyid[2]={0,0},sk_keyid[2]={0,0};
|
||||||
char *ret=NULL;
|
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)
|
if(args->pk)
|
||||||
keyid_from_pk(args->pk,pk_keyid);
|
keyid_from_pk(args->pk,pk_keyid);
|
||||||
|
|
||||||
|
@ -670,6 +670,11 @@ show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
|
|||||||
command = pct_expando (ctrl, opt.photo_viewer,&args);
|
command = pct_expando (ctrl, opt.photo_viewer,&args);
|
||||||
if(!command)
|
if(!command)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
if (!*command)
|
||||||
|
{
|
||||||
|
xfree (command);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
name = xmalloc (1 + 16 + strlen(EXTSEP_S)
|
name = xmalloc (1 + 16 + strlen(EXTSEP_S)
|
||||||
+ strlen (image_type_to_string (args.imagetype, 0)));
|
+ strlen (image_type_to_string (args.imagetype, 0)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user