All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Feuerer <pfe@sysgo.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fix cramfs resolve in case of two files, which start with same chars
Date: Thu, 28 Jul 2011 10:09:44 +0200	[thread overview]
Message-ID: <4E311948.1000203@sysgo.com> (raw)

Hi,

when having two (or more) files in cramfs which start with same name, 
cramfs_resolve didn't check the filename length and thus returned 
potentially the wrong file.

kind regards,
--peter;

Signed-off-by: Peter Feuerer <pfe@sysgo.com>

---
diff -ur u-boot-2011.06_original/fs/cramfs/cramfs.c 
u-boot-2011.06/fs/cramfs/cramfs.c
--- u-boot-2011.06_original/fs/cramfs/cramfs.c  2011-07-28 
09:48:10.000000000 +0200
+++ u-boot-2011.06/fs/cramfs/cramfs.c   2011-07-28 09:51:54.000000000 +0200
@@ -126,7 +126,8 @@
                         namelen--;
                 }

-               if (!strncmp (filename, name, namelen)) {
+               if (namelen == strlen (filename) &&
+                               !strncmp (filename, name, namelen)) {
                         char *p = strtok (NULL, "/");

                         if (raw && (p == NULL || *p == '\0'))

             reply	other threads:[~2011-07-28  8:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-28  8:09 Peter Feuerer [this message]
2011-07-28  9:24 ` [U-Boot] [PATCH] fix cramfs resolve in case of two files, which start with same chars Wolfgang Denk

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=4E311948.1000203@sysgo.com \
    --to=pfe@sysgo.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.