]> Git Repo - J-u-boot.git/commitdiff
cramfs: fix bug for wrong filename comparison
authorHolger Brunck <[email protected]>
Mon, 8 Jul 2013 07:06:49 +0000 (09:06 +0200)
committerTom Rini <[email protected]>
Mon, 15 Jul 2013 21:06:09 +0000 (17:06 -0400)
"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 <[email protected]>
cc: Wolfgang Denk <[email protected]>
cc: Albert ARIBAUD <[email protected]>

fs/cramfs/cramfs.c

index 910955dfc8ec4c3bd740b06f024608266728b786..e578a1e8bc82b2d79a0394c4c77409669f0ec38c 100644 (file)
@@ -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'))
This page took 0.039952 seconds and 4 git commands to generate.