summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2022-02-10 11:15:04 +0200
committerMichal Domonkos <mdomonko@redhat.com>2022-07-01 10:52:14 +0200
commit1c90806b275087bee5a5b6457ac5adfa7523989a (patch)
treeae7265a425610e87c22830eaa5da3e189c00d13b
parent504add3efbc03a7ca6438240ef0dc86b67671817 (diff)
downloadrpm-1c90806b275087bee5a5b6457ac5adfa7523989a.tar.gz
Ensure sane string lengths for file digests from header
(cherry picked from commit 1b938be57c9e47d434c177d46d4f9361fe873c12)
-rw-r--r--lib/rpmfi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index b67680c17..bac5c360e 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -1522,6 +1522,10 @@ static uint8_t *hex2bin(Header h, rpmTagVal tag, rpm_count_t num, size_t len)
t += len;
continue;
}
+ if (strlen(s) != len * 2) {
+ bin = rfree(bin);
+ break;
+ }
for (int j = 0; j < len; j++, t++, s += 2)
*t = (rnibble(s[0]) << 4) | rnibble(s[1]);
}