Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MOGlO-0002ud-9F for mharc-grub-devel@gnu.org; Tue, 07 Jul 2009 15:55:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOGlN-0002td-9W for grub-devel@gnu.org; Tue, 07 Jul 2009 15:55:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOGlI-0002pF-Fs for grub-devel@gnu.org; Tue, 07 Jul 2009 15:55:36 -0400 Received: from [199.232.76.173] (port=50720 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOGlI-0002oy-1P for grub-devel@gnu.org; Tue, 07 Jul 2009 15:55:32 -0400 Received: from c60.cesmail.net ([216.154.195.49]:20343) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1MOGlG-0003h0-Vf for grub-devel@gnu.org; Tue, 07 Jul 2009 15:55:31 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 07 Jul 2009 15:55:28 -0400 Received: from [192.168.0.22] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id 736B934C6A for ; Tue, 7 Jul 2009 16:03:50 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <20090706234330.31516.22217.stgit@mj.roinet.com> References: <20090706234330.31516.22217.stgit@mj.roinet.com> Content-Type: text/plain Date: Tue, 07 Jul 2009 15:55:26 -0400 Message-Id: <1246996526.3393.32.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 (2.26.3-1.fc11) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] Fix using freed memory for long option arguments X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jul 2009 19:55:37 -0000 On Mon, 2009-07-06 at 19:43 -0400, Pavel Roskin wrote: > - if (opt->longarg && ! grub_strcmp (opt->longarg, s)) > + if (opt->longarg && ! grub_strncmp (opt->longarg, s, len)) This change has an unexpected side effect, as GRUB starts recognizing abbreviated options (like --fs instead of --fs-uuid). But it would be wrong to add features in a patch that fixes bug. Besides, proper support for abbreviations should check that the abbreviation is unique. If it's not, only exact matches should be allowed. So I'm changing it to: if (opt->longarg && ! grub_strncmp (opt->longarg, s, len) && opt->longarg[len] == '\0') Committed now. -- Regards, Pavel Roskin