summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2019-01-07 14:37:06 +0200
committerPanu Matilainen <pmatilai@redhat.com>2020-03-26 11:57:58 +0200
commitb2820380109375fb0a65e5e6bd0db78b91481dc5 (patch)
tree58eb51513e7062d1efd7b1d9be6466d5217b572e
parent48819594743606e3f151da0801f8fe17dd062415 (diff)
downloadrpm-b2820380109375fb0a65e5e6bd0db78b91481dc5.tar.gz
Fix regression reading some old v4.0 era packages (#610)
Some old v4.0 era packages have RPMTAG_HEADERIMAGE in the signature header region trailer, instead of the expected RPMTAG_HEADERSIGNATURES. This was fixed in 4.4.x in commit 21818c6c8f3d4fe7836326d27f38421c29c22db7 but regressed in the commit 85a5b004306fe8486424142cdc98575c25142776 refactoring / cleanup. Reported at https://bugzilla.altlinux.org/show_bug.cgi?id=33710, original patch by Vladimir D. Seleznev. (cherry picked from commit 7a2f891d25d78cf797c789ac6859b5f2c589d296)
-rw-r--r--lib/header.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/header.c b/lib/header.c
index 616c0620c..b05fda196 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -1842,6 +1842,9 @@ static rpmRC hdrblobVerifyRegion(rpmTagVal regionTag, int exact_size,
ei2h(&trailer, &einfo);
/* Trailer offset is negative and has a special meaning */
einfo.offset = -einfo.offset;
+ /* Some old packages have HEADERIMAGE in signature region trailer, fix up */
+ if (regionTag == RPMTAG_HEADERSIGNATURES && einfo.tag == RPMTAG_HEADERIMAGE)
+ einfo.tag = RPMTAG_HEADERSIGNATURES;
if (!(einfo.tag == regionTag &&
einfo.type == REGION_TAG_TYPE && einfo.count == REGION_TAG_COUNT))
{