From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] net/route: Fix NULL pointer dereference when deleting last route
Date: Fri, 23 Dec 2011 11:54:49 +0100 [thread overview]
Message-ID: <4EF45DF9.9070606@gmail.com> (raw)
In-Reply-To: <1323164525.576940.462296647323.1.gpush@pororo>
On 06.12.2011 10:42, Jeremy Kerr wrote:
> Currently, grub_cmd_delroute will crash when deleting the last route.
> In the deletion code, we remove the matching route from the route list:
>
> *prev = route->next
>
> - route->next being NULL to mark the end of the list. We then process
> the for loop's iterator, which contains:
>
> prev =&((*prev)->next)
>
> ie,
>
> prev = NULL->next;
>
> Instead, break out of the for-loop when we've deleted the route.
>
> * grub-core/net/net.c (grub_cmd_delroute): fix NULL deref when deleting
> last route
Bug is real but fix is wrong. Committed the right fix.
> ---
> grub-core/net/net.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/grub-core/net/net.c b/grub-core/net/net.c
> index 09acea9..cafec41 100644
> --- a/grub-core/net/net.c
> +++ b/grub-core/net/net.c
> @@ -430,6 +430,7 @@ grub_cmd_delroute (struct grub_command *cmd __attribute__ ((unused)),
> *prev = route->next;
> grub_free (route->name);
> grub_free (route);
> + break;
> }
>
> return GRUB_ERR_NONE;
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
prev parent reply other threads:[~2011-12-23 10:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 9:42 [PATCH] net/route: Fix NULL pointer dereference when deleting last route Jeremy Kerr
2011-12-23 10:54 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
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=4EF45DF9.9070606@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.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 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.