From patchwork Sat Apr 23 17:42:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Hutchings X-Patchwork-Id: 729381 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3NHh5Hh020581 for ; Sat, 23 Apr 2011 17:43:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752027Ab1DWRnF (ORCPT ); Sat, 23 Apr 2011 13:43:05 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:59803 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751805Ab1DWRnE (ORCPT ); Sat, 23 Apr 2011 13:43:04 -0400 Received: from [2001:470:1f08:1539:21c:bfff:fe03:f805] (helo=localhost) by shadbolt.i.decadent.org.uk with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1QDgrC-0005Hw-C8; Sat, 23 Apr 2011 18:42:59 +0100 Received: from ben by localhost with local (Exim 4.75) (envelope-from ) id 1QDgrB-0001zj-31; Sat, 23 Apr 2011 18:42:57 +0100 From: Ben Hutchings To: Linus Torvalds Cc: LKML , linux-kbuild@vger.kernel.org, Roman Zippel Date: Sat, 23 Apr 2011 18:42:56 +0100 Message-ID: <1303580576.4815.3.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 X-SA-Exim-Connect-IP: 2001:470:1f08:1539:21c:bfff:fe03:f805 X-SA-Exim-Mail-From: ben@decadent.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on shadbolt.decadent.org.uk X-Spam-Level: **** X-Spam-Status: No, score=4.9 required=5.0 tests=FSL_HELO_NON_FQDN_1, HELO_LOCALHOST,RDNS_NONE autolearn=disabled version=3.3.1 Subject: [PATCH] kconfig: Avoid buffer underrun in choice input X-SA-Exim-Version: 4.2.1 (built Mon, 22 Mar 2010 06:51:10 +0000) X-SA-Exim-Scanned: Yes (on shadbolt.i.decadent.org.uk) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 23 Apr 2011 17:43:11 +0000 (UTC) commit 40aee729b350672c2550640622416a855e27938f ('kconfig: fix default value for choice input') fixed some cases where kconfig would select the wrong option from a choice with a single valid option and thus enter an infinite loop. However, this broke the test for user input of the form 'N?', because when kconfig selects the single valid option the input is zero-length and the test will read the byte before the input buffer. If this happens to contain '?' (as it will in a mips build on Debian unstable today) then kconfig again enters an infinite loop. Signed-off-by: Ben Hutchings Cc: stable@kernel.org [2.6.17+] --- Roman has failed to respond to this after 5 weeks and one reminder, so please take it directly. Ben. scripts/kconfig/conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 659326c..006ad81 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -332,7 +332,7 @@ static int conf_choice(struct menu *menu) } if (!child) continue; - if (line[strlen(line) - 1] == '?') { + if (line[0] && line[strlen(line) - 1] == '?') { print_help(child); continue; }