Skip to content

Commit

Permalink
Check that len is in range before using it
Browse files Browse the repository at this point in the history
This prevents integer overflows.
  • Loading branch information
DemiMarie committed Feb 18, 2021
1 parent 210198b commit 22106f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ static rpmRC hdrblobVerifyInfo(hdrblob blob, char **emsg)
/* Verify the data actually fits */
len = dataLength(info.type, ds + info.offset,
info.count, 1, ds + blob->dl);
end = info.offset + len;
if (hdrchkRange(blob->dl, end) || len <= 0)
if (hdrchkRange(blob->dl - info.offset, len))
goto err;
end = info.offset + len;
if (blob->regionTag) {
/*
* Verify that the data does not overlap the region trailer. The
Expand Down

0 comments on commit 22106f5

Please sign in to comment.