grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix two out-of-memory checks
@ 2013-03-04  4:07 Nickolai Zeldovich
  2013-03-07  7:42 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 2+ messages in thread
From: Nickolai Zeldovich @ 2013-03-04  4:07 UTC (permalink / raw)
  To: grub-devel; +Cc: nickolai

read_terminal_list() and read_crypto_list() both call

   cur->name = grub_strdup (name);

and both incorrectly check whether it failed by using "if (!name)" instead 
of "if (!cur->name)".  The patch below fixes these two issues.

Nickolai.

---

--- grub-core/normal/crypto.c	2012-03-11 13:43:18 +0000
+++ grub-core/normal/crypto.c	2013-03-04 03:46:35 +0000
@@ -136,7 +136,7 @@
  	}

        cur->name = grub_strdup (name);
-      if (! name)
+      if (! cur->name)
  	{
  	  grub_errno = GRUB_ERR_NONE;
  	  grub_free (cur);

--- grub-core/normal/term.c	2013-03-02 10:47:59 +0000
+++ grub-core/normal/term.c	2013-03-04 03:46:23 +0000
@@ -389,7 +389,7 @@
  	}

        cur->name = grub_strdup (name);
-      if (! name)
+      if (! cur->name)
  	{
  	  grub_errno = GRUB_ERR_NONE;
  	  grub_free (cur);



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix two out-of-memory checks
  2013-03-04  4:07 [PATCH] fix two out-of-memory checks Nickolai Zeldovich
@ 2013-03-07  7:42 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-03-07  7:42 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1249 bytes --]

On 04.03.2013 05:07, Nickolai Zeldovich wrote:

> read_terminal_list() and read_crypto_list() both call
> 
>   cur->name = grub_strdup (name);
> 
> and both incorrectly check whether it failed by using "if (!name)"
> instead of "if (!cur->name)".  The patch below fixes these two issues.
> 

Applied thanks. Your patch was garbled though. Please send as text
attachement next time.

> Nickolai.
> 
> ---
> 
> --- grub-core/normal/crypto.c    2012-03-11 13:43:18 +0000
> +++ grub-core/normal/crypto.c    2013-03-04 03:46:35 +0000
> @@ -136,7 +136,7 @@
>      }
> 
>        cur->name = grub_strdup (name);
> -      if (! name)
> +      if (! cur->name)
>      {
>        grub_errno = GRUB_ERR_NONE;
>        grub_free (cur);
> 
> --- grub-core/normal/term.c    2013-03-02 10:47:59 +0000
> +++ grub-core/normal/term.c    2013-03-04 03:46:23 +0000
> @@ -389,7 +389,7 @@
>      }
> 
>        cur->name = grub_strdup (name);
> -      if (! name)
> +      if (! cur->name)
>      {
>        grub_errno = GRUB_ERR_NONE;
>        grub_free (cur);
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-07  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04  4:07 [PATCH] fix two out-of-memory checks Nickolai Zeldovich
2013-03-07  7:42 ` Vladimir 'φ-coder/phcoder' Serbinenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).