aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2024-10-02 19:19:41 -0700
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-10-08 09:01:11 +0200
commitcba2d7875328b05a4a76f619de0ce7050f2df971 (patch)
tree5b0f8cdff0e6f73b3ab09eb5c75f6ce58b5775a8
parent452e706ad5a47ca32c411946c9773814ce14549c (diff)
mkfs.jffs2: fix segfault when parsing dev table
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>
-rw-r--r--jffsX-utils/mkfs.jffs2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c
index b9dd96b..da07b69 100644
--- a/jffsX-utils/mkfs.jffs2.c
+++ b/jffsX-utils/mkfs.jffs2.c
@@ -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;
}