summaryrefslogtreecommitdiff
path: root/lib/header.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/header.c')
-rw-r--r--lib/header.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/header.c b/lib/header.c
index e7b35d928..3bb7ed88a 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -131,10 +131,9 @@ static const size_t headerMaxbytes = (256*1024*1024);
/**
* Reasonableness check on count values.
- * Catches nasty stuff like negative or zero counts, which would cause
- * integer underflows in strtaglen().
+ * Most types have further restrictions, these are just the outer perimeter.
*/
-#define hdrchkCount(_count) ((_count) == 0)
+#define hdrchkCount(_dl, _count) ((_count) < 1 || (_count) > (_dl))
/**
* Sanity check on type values.
@@ -287,7 +286,7 @@ static rpmRC hdrblobVerifyInfo(hdrblob blob, char **emsg)
goto err;
if (hdrchkType(info.type))
goto err;
- if (hdrchkCount(info.count))
+ if (hdrchkCount(blob->dl, info.count))
goto err;
if (hdrchkAlign(info.type, info.offset))
goto err;