Skip to contentSkip to conversation

fix two out-of-memory checks

PATCH In review Nickolai Zeldovich 2 participants 2 messages Mar 4, 2013 – Mar 7, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix two out-of-memory checks

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.

---

normal/crypto.c +1 -1
@@ -136,7 +136,7 @@
 	}
 
       cur->name = grub_strdup (name);
-      if (! name)
+      if (! cur->name)
 	{
 	  grub_errno = GRUB_ERR_NONE;
 	  grub_free (cur);
normal/term.c +1 -1
@@ -389,7 +389,7 @@
 	}
 
       cur->name = grub_strdup (name);
-      if (! name)
+      if (! cur->name)
 	{
 	  grub_errno = GRUB_ERR_NONE;
 	  grub_free (cur);
#1 lore raw
Quoted 7 lines · Nickolai Zeldovich

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.

Quoted 34 lines

Nickolai.

---

normal/crypto.c 2013-03-04 03:46:35 +0000 renamed from normal/crypto.c 2012-03-11 13:43:18 +0000 +1 -1
@@ -136,7 +136,7 @@
     }
 
       cur->name = grub_strdup (name);
-      if (! name)
+      if (! cur->name)
     {
       grub_errno = GRUB_ERR_NONE;
       grub_free (cur);
normal/term.c 2013-03-04 03:46:23 +0000 renamed from normal/term.c 2013-03-02 10:47:59 +0000 +1 -1
@@ -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
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel