Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UCMgb-0005Fw-T7 for mharc-grub-devel@gnu.org; Sun, 03 Mar 2013 23:07:37 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCMgV-0005FY-BA for grub-devel@gnu.org; Sun, 03 Mar 2013 23:07:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCMgR-0007ly-Bv for grub-devel@gnu.org; Sun, 03 Mar 2013 23:07:31 -0500 Received: from mail-qe0-f53.google.com ([209.85.128.53]:38915) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCMgR-0007lp-6q for grub-devel@gnu.org; Sun, 03 Mar 2013 23:07:27 -0500 Received: by mail-qe0-f53.google.com with SMTP id cz11so3632091qeb.12 for ; Sun, 03 Mar 2013 20:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:x-x-sender:to:cc:subject:message-id :user-agent:mime-version:content-type; bh=Cu/rLdSR6Du5cTv1JW73fS2asfXKupJdYngctUmciZE=; b=LdcDri53OWP+zNjuqSUnaGfNHcWp4bw3OptS6uErEYt4L6tHStHzJr+frevkDP+oBR uFB37rD+DYEhkZbCc420OGJjMimxD3pV5wcEzGCLBc7p3hfxBXob9g5px0PsDP9VUqya G3EouhFNzW12xuWp/XjEh8DNa3sWtl2EVgUDiJB59SaDcYOV933xFC36N+5/+5+CAmj3 E88tBXmHGa5O81HCSaEf8XC/oGabcpFBxyQIIyXFrBmjR8HmGQXDjSQH1FJ9kFrPL3xF UB5hp5Abrg2mDLT35/sgv8xh+LHYW/kzRS2BwdP6A3CnlRAybDVMEjnTSYWcT6CDr76C gb0Q== X-Received: by 10.49.50.1 with SMTP id y1mr25379688qen.36.1362370046217; Sun, 03 Mar 2013 20:07:26 -0800 (PST) Received: from sahara (c-71-232-26-90.hsd1.ma.comcast.net. [71.232.26.90]) by mx.google.com with ESMTPS id q5sm35309263qaz.2.2013.03.03.20.07.24 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Mar 2013 20:07:25 -0800 (PST) Sender: Nickolai Zeldovich Date: Sun, 3 Mar 2013 23:07:55 -0500 (EST) From: Nickolai Zeldovich X-X-Sender: nickolai@localhost6.localdomain6 To: grub-devel@gnu.org Subject: [PATCH] fix two out-of-memory checks Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.128.53 Cc: nickolai@csail.mit.edu X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 04:07:36 -0000 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);