Skip to content

Commit

Permalink
hdrblobVerifyInfo(): reject trailing junk
Browse files Browse the repository at this point in the history
Already done by regionSwab(), but regionSwab() should not need to do
that.
  • Loading branch information
DemiMarie committed Aug 7, 2021
1 parent 68a9e05 commit 36a8ff7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/header.c
Expand Up @@ -275,14 +275,16 @@ static rpmRC hdrblobVerifyInfo(hdrblob blob, char **emsg)
int typechk = (blob->regionTag == RPMTAG_HEADERIMMUTABLE ||
blob->regionTag == RPMTAG_HEADERIMAGE);

for (i = 0; i < il; i++) {
for (i = 0;; i++) {
if (i + 1 == blob->ril && blob->regionTag) {
/* Bump the end past the region trailer */
end += REGION_TAG_COUNT;
/* Check that the region is internally consistent */
if (end != blob->rdl)
goto err;
}
if (i >= il)
break;
ei2h(&pe[i], &info);

/* Previous data must not overlap */
Expand Down Expand Up @@ -314,7 +316,8 @@ static rpmRC hdrblobVerifyInfo(hdrblob blob, char **emsg)
if (hdrchkRange(blob->dl, end) || len <= 0)
goto err;
}
return 0; /* Everything ok */
if (end == blob->dl)
return 0; /* Everything ok */

err:
if (emsg) {
Expand Down

0 comments on commit 36a8ff7

Please sign in to comment.