public inbox for initramfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nathan McSween <nwmcsween-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Nathan McSween <nwmcsween-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH] skipcpio.c: Linux only accepts 070701 cpio magic, this also fixes a comparision of signed char to 0xc7 (type limits)
Date: Sun, 28 Jun 2015 19:42:29 +0000	[thread overview]
Message-ID: <1435520549-27302-2-git-send-email-nwmcsween@gmail.com> (raw)
In-Reply-To: <1435520549-27302-1-git-send-email-nwmcsween-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

---
 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

  parent reply	other threads:[~2015-06-28 19:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-28 19:42 [PATCH] skipcpio.c: fix up cpio magic comparison Nathan McSween
     [not found] ` <1435520549-27302-1-git-send-email-nwmcsween-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-28 19:42   ` Nathan McSween [this message]
     [not found]     ` <1435520549-27302-2-git-send-email-nwmcsween-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-28 20:04       ` [PATCH] skipcpio.c: Linux only accepts 070701 cpio magic, this also fixes a comparision of signed char to 0xc7 (type limits) Dracut GitHub Import Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435520549-27302-2-git-send-email-nwmcsween@gmail.com \
    --to=nwmcsween-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox