Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 2d27fe3dff73e21c1aac97aebe0dff40 > files > 32

rpm-4.8.1-10.5.mga1.src.rpm

@@ -, +, @@ 
    Fix region length calculation and sanity check against header size
    
    - When calculating length of dribbles, we need to take into account the
      size up to that point, otherwise the alignment can be wrong causing
      the sizes not to add up.
    - With the sizes now correctly calculated, verify the sizes match up
--- a/lib/header.c	
+++ a/lib/header.c	
@@ -853,13 +853,12 @@ Header headerLoad(void * uh)
 	    indexEntry newEntry = entry + ril;
 	    int ne = (h->indexUsed - ril);
 	    int rid = entry->info.offset+1;
-	    int rc;
 
 	    /* Load dribble entries from region. */
-	    rc = regionSwab(newEntry, ne, 0, pe+ril, dataStart, dataEnd, rid);
-	    if (rc < 0)
+	    rdlen = regionSwab(newEntry, ne, rdlen, pe+ril,
+				dataStart, dataEnd, rid);
+	    if (rdlen < 0)
 		goto errxit;
-	    rdlen += rc;
 
 	  { indexEntry firstEntry = newEntry;
 	    int save = h->indexUsed;
@@ -881,6 +880,11 @@ Header headerLoad(void * uh)
 	    h->indexUsed += ne;
 	  }
 	}
+
+	rdlen += REGION_TAG_COUNT;
+
+	if (rdlen != dl)
+	    goto errxit;
     }
 
     h->flags &= ~HEADERFLAG_SORTED;