]> www.infradead.org Git - mtd-utils.git/commitdiff
mkfs.jffs2: fix segfault when parsing dev table
authorRosen Penev <rosenp@gmail.com>
Thu, 3 Oct 2024 02:19:41 +0000 (19:19 -0700)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Tue, 8 Oct 2024 07:01:11 +0000 (09:01 +0200)
Make sure that the first item is parsed correctly. One issue otherwise is
a null pointer dereference when the first item is not found.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
jffsX-utils/mkfs.jffs2.c

index b9dd96b27f2e3c4bf749ce9647e16f3b6bd28b1e..da07b69e4e87d87f6d19c65d0fb24862fabf963b 100644 (file)
@@ -428,7 +428,7 @@ static int interpret_table_entry(struct filesystem_entry *root, char *line)
 
        if (sscanf (line, "%" SCANF_PREFIX "s %c %lo %lu %lu %lu %lu %lu %lu %lu",
                                SCANF_STRING(name), &type, &mode, &uid, &gid, &major, &minor,
-                               &start, &increment, &count) < 0)
+                               &start, &increment, &count) < 2)
        {
                return 1;
        }