e2fsprogs/e2fsprogs-1.41.4-fix-blkid-segfault.patch
Eric Sandeen cccab5f53f * Thu Feb 26 2009 Eric Sandeen <sandeen@redhat.com> 1.41.4-4
- Edit summary & description to include ext4 (#487469)
- Fix blkid null ptr deref in initrd (#486997)
2009-02-26 22:29:21 +00:00

57 lines
1.6 KiB
Diff

The coverity scanner found this one.
If a line in modules.dep has a ":" but no "/" then:
if ((cp = strchr(buf, ':')) != NULL)
*cp = 0;
else
continue;
if ((cp = strrchr(buf, '/')) != NULL)
cp++;
/* XXX else cp is still null */
i = strlen(cp);
... we will deref a null pointer (cp). This can be
demonstrated by putting a line like:
foo.ko:
into modules.dep. The below change just says that if no "/" is
found, treat the whole string as the module name.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Index: e2fsprogs/e2fsck/util.c
===================================================================
--- e2fsprogs.orig/e2fsck/util.c
+++ e2fsprogs/e2fsck/util.c
@@ -663,6 +663,8 @@ int check_for_modules(const char *fs_nam
continue;
if ((cp = strrchr(buf, '/')) != NULL)
cp++;
+ else
+ cp = buf;
i = strlen(cp);
if (i > 3) {
t = cp + i - 3;
Index: e2fsprogs/lib/blkid/probe.c
===================================================================
--- e2fsprogs.orig/lib/blkid/probe.c
+++ e2fsprogs/lib/blkid/probe.c
@@ -227,6 +227,8 @@ static int check_for_modules(const char
continue;
if ((cp = strrchr(buf, '/')) != NULL)
cp++;
+ else
+ cp = buf;
i = strlen(cp);
if (i > 3) {
t = cp + i - 3;
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html