From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Feuerer Date: Thu, 28 Jul 2011 10:09:44 +0200 Subject: [U-Boot] [PATCH] fix cramfs resolve in case of two files, which start with same chars Message-ID: <4E311948.1000203@sysgo.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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'))