- Fix SIGSEGV in case of old unsupported gpg keys

- Resolves: #1277464
This commit is contained in:
Lubos Kardos 2015-11-06 13:58:53 +01:00
parent ff5589a250
commit 17475305ec
2 changed files with 67 additions and 1 deletions

View File

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

View File

@ -29,7 +29,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}4%{?dist}
Release: %{?snapver:0.%{snapver}.}5%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@ -54,6 +54,7 @@ Patch5: rpm-4.12.0-rpm2cpio-hack.patch
# Patches already upstream:
Patch100: rpm-4.13.0-rc1-Fix-new-richdep-syntax.patch
Patch101: rpm-4.13.0-selinux--permissive-scriptlets.patch
Patch102: rpm-4.13.0-unsupported-keys.patch
# These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch
@ -556,6 +557,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Fri Nov 06 2015 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.5
- Fix SIGSEGV in case of old unsupported gpg keys (#1277464)
* Mon Oct 12 2015 Florian Festi <ffesti@rpm.org> - 4.4.13.0-0.rc1.4
- Fix selinux plugin for permissive mode