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().
gnupgparse.c | 2 +- pgpkey.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
# HG changeset patch # User Kevin McCarthy <[email protected]> # Date 1365627829 25200 # Branch HEAD # Node ID a401a71b28134d1aa688d6847b2564e3159a2c79 # Parent 6eb6a30cad1c28156f1f91394926947a1bab5cfb Wrap pgp_uid_t->addr in NONULL(). 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(). diff --git a/gnupgparse.c b/gnupgparse.c --- a/gnupgparse.c +++ b/gnupgparse.c @@ -289,17 +289,17 @@ */ if (!(pend && (*p || is_pub))) break; /* ignore user IDs on subkeys */ 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); uid->addr = safe_strdup (p); uid->trust = trust; uid->flags |= flags; uid->next = tmp.address; tmp.address = uid; diff --git a/pgpkey.c b/pgpkey.c --- a/pgpkey.c +++ b/pgpkey.c @@ -223,17 +223,17 @@ snprintf (fmt, sizeof (fmt), "%%%ss", prefix); snprintf (dest, destlen, fmt, _pgp_keyid (key)); } break; case 'u': if (!optional) { snprintf (fmt, sizeof (fmt), "%%%ss", prefix); - snprintf (dest, destlen, fmt, uid->addr); + snprintf (dest, destlen, fmt, NONULL (uid->addr)); } break; case 'a': if (!optional) { snprintf (fmt, sizeof (fmt), "%%%ss", prefix); snprintf (dest, destlen, fmt, key->algorithm); } @@ -581,17 +581,17 @@ pgp_keyid (pgp_principal_key (KeyTable[menu->current]->parent))); mutt_do_pager (cmd, tempfile, 0, NULL); menu->redraw = REDRAW_FULL; break; 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: /* XXX make error reporting more verbose */ if (option (OPTPGPCHECKTRUST)) @@ -951,17 +951,17 @@ if (abilities && !(k->flags & abilities)) continue; match = 0; 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) && !mutt_strcasecmp (p + 2, k->keyid + 8)) || mutt_stristr (a->addr, p)) { dprint (5, (debugfile, "match.\n")); match = 1;
