All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fix cramfs resolve in case of two files, which start with same chars
@ 2011-07-28  8:09 Peter Feuerer
  2011-07-28  9:24 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Feuerer @ 2011-07-28  8:09 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] fix cramfs resolve in case of two files, which start with same chars
  2011-07-28  8:09 [U-Boot] [PATCH] fix cramfs resolve in case of two files, which start with same chars Peter Feuerer
@ 2011-07-28  9:24 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2011-07-28  9:24 UTC (permalink / raw)
  To: u-boot

Dear Peter Feuerer,

In message <4E311948.1000203@sysgo.com> you wrote:
> 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;

Please move greetings out of the commit message.

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

Please fix all the errors and warnings reported by checkpatch, and
resubmit.  Consider using "git format-patch" and "git send-email".

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is surely a great calamity for  a  human  being  to  have  no  ob-
sessions.                                                - Robert Bly

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-28  9:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-28  8:09 [U-Boot] [PATCH] fix cramfs resolve in case of two files, which start with same chars Peter Feuerer
2011-07-28  9:24 ` Wolfgang Denk

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.