[PATCHv2] mkfs.jffs2: fix segfault when parsing dev table
Zhihao Cheng
chengzhihao1 at huawei.com
Mon Oct 7 19:39:07 PDT 2024
在 2024/10/3 10:19, Rosen Penev 写道:
> 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 at gmail.com>
> ---
> jffsX-utils/mkfs.jffs2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Zhihao Cheng <chengzhihao1 at huawei.com>
> 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;
> }
>
More information about the linux-mtd
mailing list