michal-grzedzicki / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
5860f5
commit 65c7cc17664358051f0358de272e616dd88ab624
5860f5
Author: Panu Matilainen <pmatilai@redhat.com>
5860f5
Date:   Tue Aug 27 15:15:40 2013 +0300
5860f5
5860f5
    Relax the filename triplet sanity check a bit (RhBug:1001553)
5860f5
    
5860f5
    - At least unowned directories can cause orphans to be left around
5860f5
      in RPMTAG_DIRNAMES, in which case its possible for number of
5860f5
      dirnames to be larger than the number of basenames. This is
5860f5
      arguably a bug in the relocation code but doesn't seem worth
5860f5
      the trouble... so just relax the check to simply permit non-empty
5860f5
      dirnames array, the index bound checking is far more important.
5860f5
5860f5
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
5860f5
index 30663d0..00506ce 100644
5860f5
--- a/lib/rpmfi.c
5860f5
+++ b/lib/rpmfi.c
5860f5
@@ -1128,7 +1128,8 @@ static int indexSane(rpmtd xd, rpmtd yd, rpmtd zd)
5860f5
     uint32_t zc = rpmtdCount(zd);
5860f5
 
5860f5
     /* check that the amount of data in each is sane */
5860f5
-    if (xc > 0 && yc > 0 && yc <= xc && zc == xc) {
5860f5
+    /* normally yc <= xc but larger values are not fatal (RhBug:1001553) */
5860f5
+    if (xc > 0 && yc > 0 && zc == xc) {
5860f5
 	uint32_t * i;
5860f5
 	/* ...and that the indexes are within bounds */
5860f5
 	while ((i = rpmtdNextUint32(zd))) {