summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorHolger Brunck <holger.brunck@keymile.com>2013-07-08 09:06:49 +0200
committerTom Rini <trini@ti.com>2013-07-15 17:06:09 -0400
commit457dd025a2899dd486e594ce3dc4afaa4ea09998 (patch)
tree21c46a6e1a70f3fa27fa7346814a6e18bde288b2 /fs
parentc8605bb4d8f0ded37e863b0a4fe2844ce5e8e2fa (diff)
downloadu-boot-457dd025a2899dd486e594ce3dc4afaa4ea09998.tar.gz
u-boot-457dd025a2899dd486e594ce3dc4afaa4ea09998.tar.xz
u-boot-457dd025a2899dd486e594ce3dc4afaa4ea09998.zip
cramfs: fix bug for wrong filename comparison
"cramfsload uImage_1" succeeds even though the actual file is named "uImage". Fix file name comparison when one name is the prefix of the other. Signed-off-by: Holger Brunck <holger.brunck@keymile.com> cc: Wolfgang Denk <wd@denx.de> cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/cramfs/cramfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
index 910955dfc8..e578a1e8bc 100644
--- a/fs/cramfs/cramfs.c
+++ b/fs/cramfs/cramfs.c
@@ -126,7 +126,8 @@ static unsigned long cramfs_resolve (unsigned long begin, unsigned long offset,
namelen--;
}
- if (!strncmp (filename, name, namelen)) {
+ if (!strncmp(filename, name, namelen) &&
+ (namelen == strlen(filename))) {
char *p = strtok (NULL, "/");
if (raw && (p == NULL || *p == '\0'))