From: Kevin McCarthy Date: Thu, 3 Sep 2015 01:11:28 +0000 (-0700) Subject: Add time_t conversion to fix gpgme segfault on OpenBSD. X-Git-Tag: neomutt-20160404~121^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4cc6c93717a03789194e08185a34bf30884a07e6;p=neomutt Add time_t conversion to fix gpgme segfault on OpenBSD. time_t isn't the same size as gpgme_subkey_t->timestamp on OpenBSD. Passing &subkey->timestamp to localtime was therefore passing an address to the wrong size int and was causing a segfault. Thanks to Hannes Wenzel for reporting the bug and providing a patch. --- diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 060fc2f2e..4cac7a113 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -2018,6 +2018,7 @@ static int pgp_gpgme_extract_keys (gpgme_data_t keydata, FILE** fp, int dryrun) char date[STRING]; int more; int rc = -1; + time_t tt; if ((err = gpgme_new (&tmpctx)) != GPG_ERR_NO_ERROR) { @@ -2081,7 +2082,8 @@ static int pgp_gpgme_extract_keys (gpgme_data_t keydata, FILE** fp, int dryrun) len = mutt_strlen (subkey->keyid); if (len > 8) shortid += len - 8; - strftime (date, sizeof (date), "%Y-%m-%d", localtime (&subkey->timestamp)); + tt = subkey->timestamp; + strftime (date, sizeof (date), "%Y-%m-%d", localtime (&tt)); if (!more) fprintf (*fp, "%s %5.5s %d/%8s %s %s\n", more ? "sub" : "pub",