grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fix two out-of-memory checks


From: Nickolai Zeldovich
Subject: [PATCH] fix two out-of-memory checks
Date: Sun, 3 Mar 2013 23:07:55 -0500 (EST)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]