[PATCH] kconfig: protect locale-unsafe calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Signed-off-by: Arnaud Lacombe <lacombar@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux