[PATCH] skipcpio.c: Linux only accepts 070701 cpio magic, this also fixes a comparision of signed char to 0xc7 (type limits)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 skipcpio/skipcpio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/skipcpio/skipcpio.c b/skipcpio/skipcpio.c
index 445d7f6..486e00f 100644
--- a/skipcpio/skipcpio.c
+++ b/skipcpio/skipcpio.c
@@ -59,9 +59,8 @@ int main(int argc, char **argv)
         }
         fseek(f, 0, SEEK_SET);

-        /* check, if this is a cpio archive */
-        if ((buf[0] == 0x71 && buf[1] == 0xc7)
-            || (buf[0] == '0' && buf[1] == '7' && buf[2] == '0' && buf[3] == '7' && buf[4] == '0' && buf[5] == '1')) {
+        /* check, if this is a cpio archive, linux only accepts "070701" */
+        if (!memcmp(buf "070701", 6)) {
                 long pos = 0;

                 /* Search for CPIO_END */
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux