From: "Thomas Schmitt" <scdbackup@gmx.net>
To: grub-devel@gnu.org
Cc: lidong.chen@oracle.com, fengtao40@huawei.com, yanan@huawei.com,
daniel.kiper@oracle.com, lichenca2005@gmail.com
Subject: Re: [PATCH v2 3/5] fs/iso9660: Avoid reading past the entry boundary
Date: Wed, 18 Jan 2023 17:14:56 +0100 [thread overview]
Message-ID: <12402393031740855516@scdbackup.webframe.org> (raw)
In-Reply-To: <ed42475d1250562f4767829746ccd6dc0012694d.1673991546.git.lidong.chen@oracle.com>
Hi,
On Wed, 18 Jan 2023 08:23:56 +0000 Lidong Chen <lidong.chen@oracle.com> wrote:
> Added a check for the SP entry data boundary before reading it.
>
> Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
> Reviewed-by: Thomas Schmitt <scdbackup@gmx.net>
> ---
> grub-core/fs/iso9660.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c
> index 65c8862b6..c6d65fc22 100644
> --- a/grub-core/fs/iso9660.c
> +++ b/grub-core/fs/iso9660.c
> @@ -409,6 +409,9 @@ set_rockridge (struct grub_iso9660_data *data)
> if (!sua_size)
> return GRUB_ERR_NONE;
>
> + if (sua_size < GRUB_ISO9660_SUSP_HEADER_SZ)
> + return grub_error (GRUB_ERR_BAD_FS, "invalid rock ridge entry size");
> +
> sua = grub_malloc (sua_size);
> if (! sua)
> return grub_errno;
> @@ -435,8 +438,17 @@ set_rockridge (struct grub_iso9660_data *data)
> rootnode.have_symlink = 0;
> rootnode.dirents[0] = data->voldesc.rootdir;
>
> - /* The 2nd data byte stored how many bytes are skipped every time
> - to get to the SUA (System Usage Area). */
> + /* The size of SP (version 1) is fixed to 7. */
> + if (sua_size < 7 || entry->len < 7)
> + {
> + grub_free (sua);
> + return grub_error (GRUB_ERR_BAD_FS, "corrupted rock ridge entry");
> + }
> +
> + /*
> + * The 2nd data byte stored how many bytes are skipped every time
> + * to get to the SUA (System Usage Area).
> + */
> data->susp_skip = entry->data[2];
> entry = (struct grub_iso9660_susp_entry *) ((char *) entry + entry->len);
>
> --
> 2.35.1
Reviewed-by: Thomas Schmitt <scdbackup@gmx.net>
My minor objections towards v1 are now addressed.
Have a nice day :)
Thomas
next prev parent reply other threads:[~2023-01-18 16:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 8:23 [PATCH v2 0/5] fs/iso9660: Fix out-of-bounds read Lidong Chen
2023-01-18 8:23 ` [PATCH v2 1/5] fs/iso9660: Add check to prevent infinite loop Lidong Chen
2023-01-18 16:07 ` Thomas Schmitt
2023-01-19 1:34 ` Lidong Chen
2023-01-18 8:23 ` [PATCH v2 2/5] fs/iso9660: Prevent read past the end of system use area Lidong Chen
2023-01-18 16:12 ` Thomas Schmitt
2023-01-18 8:23 ` [PATCH v2 3/5] fs/iso9660: Avoid reading past the entry boundary Lidong Chen
2023-01-18 16:14 ` Thomas Schmitt [this message]
2023-01-18 8:23 ` [PATCH v2 4/5] fs/iso9660: Incorrect check for " Lidong Chen
2023-01-18 16:17 ` Thomas Schmitt
2023-01-18 8:23 ` [PATCH v2 5/5] fs/iso9660: Prevent skipping CE or ST at start of continuation area Lidong Chen
2023-01-18 16:21 ` Thomas Schmitt
2023-01-19 1:25 ` Lidong Chen
2023-01-18 16:31 ` [PATCH v2 0/5] fs/iso9660: Fix out-of-bounds read Thomas Schmitt
2023-01-19 1:22 ` Lidong Chen
2023-01-19 11:58 ` Thomas Schmitt
2023-01-20 2:29 ` Lidong Chen
2023-01-20 11:49 ` Thomas Schmitt
2023-01-20 19:31 ` Lidong Chen
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=12402393031740855516@scdbackup.webframe.org \
--to=scdbackup@gmx.net \
--cc=daniel.kiper@oracle.com \
--cc=fengtao40@huawei.com \
--cc=grub-devel@gnu.org \
--cc=lichenca2005@gmail.com \
--cc=lidong.chen@oracle.com \
--cc=yanan@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.