From: Holger Brunck Date: Mon, 8 Jul 2013 07:06:49 +0000 (+0200) Subject: cramfs: fix bug for wrong filename comparison X-Git-Tag: v2013.07~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=457dd025a2899dd486e594ce3dc4afaa4ea09998;p=u-boot 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 cc: Wolfgang Denk cc: Albert ARIBAUD --- 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'))