From patchwork Tue Aug 16 05:19:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnaud Lacombe X-Patchwork-Id: 1070302 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7G5Jgdr010461 for ; Tue, 16 Aug 2011 05:19:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751489Ab1HPFTl (ORCPT ); Tue, 16 Aug 2011 01:19:41 -0400 Received: from mail-gy0-f174.google.com ([209.85.160.174]:39583 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751456Ab1HPFTl (ORCPT ); Tue, 16 Aug 2011 01:19:41 -0400 Received: by gya6 with SMTP id 6so3592578gya.19 for ; Mon, 15 Aug 2011 22:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=tUAOCS5pbl2ne1Yokf2L1qAthPL7DHrOkqqgM4j+EUo=; b=ONh4+ps+eqK86UCvaCpIUlXyg0xqEzpNlCYjPW34qlxewrmKEwKRLUnXT0AUVr1bet eeYZI7nTwspGJ/KHWlcp4JfXKgGJwWn2oNHg/PoWbDIkfJ5t4oCFINRdUMV2NO0siGBA G2ZvBzgoxJJ2aDq/wfpCk1CiiiWW5uHjNQiww= Received: by 10.147.127.29 with SMTP id e29mr4661618yan.15.1313471980619; Mon, 15 Aug 2011 22:19:40 -0700 (PDT) Received: from localhost.localdomain (69-165-142-232.dsl.teksavvy.com [69.165.142.232]) by mx.google.com with ESMTPS id a29sm596468yhj.45.2011.08.15.22.19.39 (version=SSLv3 cipher=OTHER); Mon, 15 Aug 2011 22:19:39 -0700 (PDT) From: Arnaud Lacombe To: linux-kbuild@vger.kernel.org Cc: s.koylux@gmail.com, Arnaud Lacombe Subject: [PATCH] kconfig: protect locale-unsafe calls Date: Tue, 16 Aug 2011 01:19:33 -0400 Message-Id: <1313471973-13966-1-git-send-email-lacombar@gmail.com> X-Mailer: git-send-email 1.7.6.153.g78432 MIME-Version: 1.0 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]); Tue, 16 Aug 2011 05:19:42 +0000 (UTC) There is a few calls in kconfig where we end-up using tolower(3) or toupper(3) in an unsafe manner. As highlighted by Serdar, it would seem that Turkish's locale do not have representable lowercase for the Engligh capital-dotless-i. Introduces locale-safe portion in the backend where we reset the local to the default "C". Reported-by: Serdar KÖYLÜ Signed-off-by: Arnaud Lacombe --- scripts/kconfig/confdata.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 5a58965..7b1bbb8 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -828,6 +828,8 @@ static int conf_split_config(void) if (chdir("include/config")) return 1; + setlocale(LC_ALL, "C"); + res = 0; for_all_symbols(i, sym) { sym_calc_value(sym); @@ -918,6 +920,9 @@ static int conf_split_config(void) } close(fd); } + + setlocale(LC_ALL, ""); + out: if (chdir("../..")) return 1; @@ -956,6 +961,8 @@ int conf_write_autoconf(void) return 1; } + setlocale(LC_ALL, "C"); + conf_write_heading(out, &kconfig_printer_cb, NULL); conf_write_heading(tristate, &tristate_printer_cb, NULL); @@ -979,6 +986,9 @@ int conf_write_autoconf(void) conf_write_symbol(out_h, sym, &header_printer_cb, NULL); } + + setlocale(LC_ALL, ""); + fclose(out); fclose(tristate); fclose(out_h);