summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDemi Marie Obenour <demi@invisiblethingslab.com>2022-02-12 13:46:28 -0500
committerMichal Domonkos <mdomonko@redhat.com>2022-07-01 10:52:14 +0200
commit824f62a08a6a93b41b5dfb92501518e9378244fc (patch)
tree87de2d85092dbf38aa40a607c1895bd8c1a3b2aa
parent5ff0b96adf5f43651f123acd2f83274dba920374 (diff)
downloadrpm-824f62a08a6a93b41b5dfb92501518e9378244fc.tar.gz
Avoid reading out of bounds of the i18ntable
If the i18ntable was smaller than the i18nstring entry an out of bounds read could result. This should not happen in a valid package, but even if RPM rejected such packages during load, this situation could still result as a result of usage of the RPM API. (cherry picked from commit db8fc1057e38839adc04e263fe255ce86cab9fa7)
-rw-r--r--lib/header.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/header.c b/lib/header.c
index 098ea5d01..c939006ab 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -1311,7 +1311,7 @@ static int copyI18NEntry(Header h, indexEntry entry, rpmtd td,
/* For each entry in the header ... */
for (langNum = 0, t = table->data, ed = entry->data;
- langNum < entry->info.count;
+ langNum < entry->info.count && langNum < table->info.count;
langNum++, t += strlen(t) + 1, ed += strlen(ed) + 1) {
int match = headerMatchLocale(t, l, le);