Fix rpm -K segfaulting on corrupted header
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 13 Nov 2007 11:11:54 +0000 (13:11 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 13 Nov 2007 11:11:54 +0000 (13:11 +0200)
(http://qa.mandriva.com/show_bug.cgi?id=#33735)

Patch from Pascal Rigaux

rpmdb/header.c

index 4c87f4c..3954969 100644 (file)
@@ -1239,7 +1239,7 @@ static int copyEntry(const indexEntry entry,
 
            dataStart = (unsigned char *) memcpy(pe + ril, dataStart, rdl);
 
-           rc = regionSwab(NULL, ril, 0, pe, dataStart, NULL, 0);
+           rc = regionSwab(NULL, ril, 0, pe, dataStart, dataStart + rdl, 0);
            /* XXX 1 on success. */
            rc = (rc < 0) ? 0 : 1;
        } else {