|
Lubos Kardos |
aa8a7b |
From 2dd06933726cf5191e05264901789f8e1da6e51d Mon Sep 17 00:00:00 2001
|
|
Lubos Kardos |
aa8a7b |
From: Lubos Kardos <lkardos@redhat.com>
|
|
Lubos Kardos |
aa8a7b |
Date: Fri, 6 Nov 2015 12:45:32 +0100
|
|
Lubos Kardos |
aa8a7b |
Subject: [PATCH] Fix SIGSEGV in case of old unsupported gpg keys
|
|
Lubos Kardos |
aa8a7b |
(rhbz:1277464)
|
|
Lubos Kardos |
aa8a7b |
|
|
Lubos Kardos |
aa8a7b |
Regression from: a173d781a631a92524ce5be364c679ba19b3e321
|
|
Lubos Kardos |
aa8a7b |
Adds also warning that gpg key is not supported.
|
|
Lubos Kardos |
aa8a7b |
---
|
|
Lubos Kardos |
aa8a7b |
rpmio/rpmkeyring.c | 5 ++---
|
|
Lubos Kardos |
aa8a7b |
rpmio/rpmpgp.c | 5 +++++
|
|
Lubos Kardos |
aa8a7b |
2 files changed, 7 insertions(+), 3 deletions(-)
|
|
Lubos Kardos |
aa8a7b |
|
|
Lubos Kardos |
aa8a7b |
diff --git a/rpmio/rpmkeyring.c b/rpmio/rpmkeyring.c
|
|
Lubos Kardos |
aa8a7b |
index b6b5703..c3d2c19 100644
|
|
Lubos Kardos |
aa8a7b |
--- a/rpmio/rpmkeyring.c
|
|
Lubos Kardos |
aa8a7b |
+++ b/rpmio/rpmkeyring.c
|
|
Lubos Kardos |
aa8a7b |
@@ -159,9 +159,8 @@ rpmPubkey *rpmGetSubkeys(rpmPubkey mainkey, int *count)
|
|
Lubos Kardos |
aa8a7b |
int pgpsubkeysCount = 0;
|
|
Lubos Kardos |
aa8a7b |
int i;
|
|
Lubos Kardos |
aa8a7b |
|
|
Lubos Kardos |
aa8a7b |
- if (!pgpPrtParamsSubkeys(mainkey->pkt, mainkey->pktlen, mainkey->pgpkey,
|
|
Lubos Kardos |
aa8a7b |
- &pgpsubkeys, &pgpsubkeysCount)) {
|
|
Lubos Kardos |
aa8a7b |
-
|
|
Lubos Kardos |
aa8a7b |
+ if (mainkey && !pgpPrtParamsSubkeys(mainkey->pkt, mainkey->pktlen,
|
|
Lubos Kardos |
aa8a7b |
+ mainkey->pgpkey, &pgpsubkeys, &pgpsubkeysCount)) {
|
|
Lubos Kardos |
aa8a7b |
|
|
Lubos Kardos |
aa8a7b |
subkeys = xmalloc(pgpsubkeysCount * sizeof(*subkeys));
|
|
Lubos Kardos |
aa8a7b |
|
|
Lubos Kardos |
aa8a7b |
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
|
|
Lubos Kardos |
aa8a7b |
index f020650..6f8d77b 100644
|
|
Lubos Kardos |
aa8a7b |
--- a/rpmio/rpmpgp.c
|
|
Lubos Kardos |
aa8a7b |
+++ b/rpmio/rpmpgp.c
|
|
Lubos Kardos |
aa8a7b |
@@ -624,6 +624,7 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen,
|
|
Lubos Kardos |
aa8a7b |
rc = pgpPrtSigParams(tag, v->pubkey_algo, v->sigtype, p, h, hlen, _digp);
|
|
Lubos Kardos |
aa8a7b |
} break;
|
|
Lubos Kardos |
aa8a7b |
default:
|
|
Lubos Kardos |
aa8a7b |
+ rpmlog(RPMLOG_WARNING, _("Unsupported version of key: V%d\n"), h[0]);
|
|
Lubos Kardos |
aa8a7b |
rc = 1;
|
|
Lubos Kardos |
aa8a7b |
break;
|
|
Lubos Kardos |
aa8a7b |
}
|
|
Lubos Kardos |
aa8a7b |
@@ -710,6 +711,8 @@ static int pgpPrtKey(pgpTag tag, const uint8_t *h, size_t hlen,
|
|
Lubos Kardos |
aa8a7b |
rc = pgpPrtPubkeyParams(v->pubkey_algo, p, h, hlen, _digp);
|
|
Lubos Kardos |
aa8a7b |
}
|
|
Lubos Kardos |
aa8a7b |
} break;
|
|
Lubos Kardos |
aa8a7b |
+ default:
|
|
Lubos Kardos |
aa8a7b |
+ rpmlog(RPMLOG_WARNING, _("Unsupported version of key: V%d\n"), h[0]);
|
|
Lubos Kardos |
aa8a7b |
}
|
|
Lubos Kardos |
aa8a7b |
return rc;
|
|
Lubos Kardos |
aa8a7b |
}
|
|
Lubos Kardos |
aa8a7b |
@@ -775,6 +778,8 @@ static int getFingerprint(const uint8_t *h, size_t hlen, pgpKeyID_t keyid)
|
|
Lubos Kardos |
aa8a7b |
}
|
|
Lubos Kardos |
aa8a7b |
|
|
Lubos Kardos |
aa8a7b |
} break;
|
|
Lubos Kardos |
aa8a7b |
+ default:
|
|
Lubos Kardos |
aa8a7b |
+ rpmlog(RPMLOG_WARNING, _("Unsupported version of key: V%d\n"), h[0]);
|
|
Lubos Kardos |
aa8a7b |
}
|
|
Lubos Kardos |
aa8a7b |
return rc;
|
|
Lubos Kardos |
aa8a7b |
}
|
|
Lubos Kardos |
aa8a7b |
--
|
|
Lubos Kardos |
aa8a7b |
1.9.3
|
|
Lubos Kardos |
aa8a7b |
|