diff options
author | Holger Brunck <holger.brunck@keymile.com> | 2013-07-08 09:06:49 +0200 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2013-07-15 17:06:09 -0400 |
commit | 457dd025a2899dd486e594ce3dc4afaa4ea09998 (patch) | |
tree | 21c46a6e1a70f3fa27fa7346814a6e18bde288b2 | |
parent | c8605bb4d8f0ded37e863b0a4fe2844ce5e8e2fa (diff) |
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>
-rw-r--r-- | fs/cramfs/cramfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c index 910955dfc8e..e578a1e8bc8 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')) |