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