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

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).