Skip to contentSkip to conversation

skipcpio.c: fix up cpio magic comparison

PATCH New Nathan McSween 2 participants 3 messages Jun 28, 2015 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 skipcpio.c: fix up cpio magic comparison

Nathan McSween (1):
skipcpio.c: Linux only accepts 070701 cpio magic, this also fixes a

    comparision of signed char to 0xc7 (type limits)
 skipcpio/skipcpio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.4.5

A message that is not in the archive (sent off-list or not yet received): 1435520549-27302-1-git-send-email-nwmcsween-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

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

---
 skipcpio/skipcpio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
skipcpio/skipcpio.c +2 -3
index 445d7f6..486e00f 100644
@@ -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 */
Signature · 1 line
2.4.5

A message that is not in the archive (sent off-list or not yet received): 1435520549-27302-2-git-send-email-nwmcsween-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org