wuyuoss / rpms / rpm

Forked from rpms/rpm 3 years ago
Clone
b7b7cd
--- rpm-4.11.1.orig/lib/cpio.c	2014-11-28 12:21:50.444158675 +0100
b7b7cd
+++ rpm-4.11.1/lib/cpio.c	2014-11-28 12:22:53.776453253 +0100
b7b7cd
@@ -296,6 +296,9 @@
b7b7cd
     st->st_rdev = makedev(major, minor);
b7b7cd
 
b7b7cd
     GET_NUM_FIELD(hdr.namesize, nameSize);
b7b7cd
+    if (nameSize <= 0 || nameSize > 4096) {
b7b7cd
+        return CPIOERR_BAD_HEADER;
b7b7cd
+    }
b7b7cd
 
b7b7cd
     *path = xmalloc(nameSize + 1);
b7b7cd
     read = Fread(*path, nameSize, 1, cpio->fd);