Skip to content

Commit

Permalink
Wrap pgp_uid_t->addr in NONULL(). (closes #3564)
Browse files Browse the repository at this point in the history
The previous patch introduced the possibility for addr to be null.  Mutt
is surprisingly robust against null strings, but there are a few places
that should be wrapped in NONULL().
  • Loading branch information
kevin8t8 authored and karelzak committed Feb 9, 2015
1 parent 655ef37 commit 7095039
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gnupgparse.c
Expand Up @@ -294,7 +294,7 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
if (!is_uid && (*is_subkey && option (OPTPGPIGNORESUB)))
break;

dprint (2, (debugfile, "user ID: %s\n", p));
dprint (2, (debugfile, "user ID: %s\n", NONULL (p)));

uid = safe_calloc (sizeof (pgp_uid_t), 1);
fix_uid (p);
Expand Down
6 changes: 3 additions & 3 deletions pgpkey.c
Expand Up @@ -228,7 +228,7 @@ static const char *pgp_entry_fmt (char *dest,
if (!optional)
{
snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
snprintf (dest, destlen, fmt, uid->addr);
snprintf (dest, destlen, fmt, NONULL (uid->addr));
}
break;
case 'a':
Expand Down Expand Up @@ -586,7 +586,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys,

case OP_VIEW_ID:

mutt_message ("%s", KeyTable[menu->current]->addr);
mutt_message ("%s", NONULL (KeyTable[menu->current]->addr));
break;

case OP_GENERIC_SELECT_ENTRY:
Expand Down Expand Up @@ -980,7 +980,7 @@ pgp_key_t pgp_getkeybystr (char *p, short abilities, pgp_ring_t keyring)
for (a = k->address; a; a = a->next)
{
dprint (5, (debugfile, "pgp_getkeybystr: matching \"%s\" against key %s, \"%s\": ",
p, pgp_keyid (k), a->addr));
p, pgp_keyid (k), NONULL (a->addr)));
if (!*p || mutt_strcasecmp (p, pgp_keyid (k)) == 0 ||
(!mutt_strncasecmp (p, "0x", 2) && !mutt_strcasecmp (p + 2, pgp_keyid (k))) ||
(option (OPTPGPLONGIDS) && !mutt_strncasecmp (p, "0x", 2) &&
Expand Down

0 comments on commit 7095039

Please sign in to comment.