From: Rosen Penev <rosenp@gmail.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] mkfs.jffs2: fix segfault when parsing dev table
Date: Fri, 27 Sep 2024 14:14:08 -0700 [thread overview]
Message-ID: <20240927211409.874433-1-rosenp@gmail.com> (raw)
Make sure that all 10 items are 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>
---
jffsX-utils/mkfs.jffs2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c
index b9dd96b..63dac1c 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) < 10)
{
return 1;
}
--
2.46.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next reply other threads:[~2024-09-27 21:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 21:14 Rosen Penev [this message]
2024-09-29 2:12 ` [PATCH] mkfs.jffs2: fix segfault when parsing dev table Zhihao Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240927211409.874433-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox