All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kconfig: protect locale-unsafe calls
@ 2011-08-16  5:19 Arnaud Lacombe
  2011-08-16  5:21 ` Arnaud Lacombe
  2011-08-31 12:19 ` Michal Marek
  0 siblings, 2 replies; 6+ messages in thread
From: Arnaud Lacombe @ 2011-08-16  5:19 UTC (permalink / raw)
  To: linux-kbuild; +Cc: s.koylux, Arnaud Lacombe

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Ü <s.koylux@gmail.com>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
---
 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);
-- 
1.7.6.153.g78432


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-01 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-16  5:19 [PATCH] kconfig: protect locale-unsafe calls Arnaud Lacombe
2011-08-16  5:21 ` Arnaud Lacombe
2011-08-31 12:19 ` Michal Marek
2011-08-31 13:31   ` [PATCH] staging/cxt1e1: Header cleanup Michal Marek
2011-08-31 13:35   ` [PATCH] kconfig: protect locale-unsafe calls Arnaud Lacombe
2011-09-01 14:23   ` Michal Marek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.