[PATCH 1/3] bootconfig: Support non-ascii characters in value

From: Masami Hiramatsu
Date: Fri Feb 14 2020 - 01:10:30 EST


Support non-ascii (u8 code > 128) characters in the
value data. This will allow user to pass utf-8 data
as a value in a bootconfig. (Note that ascii non-
printable characters are still not allowed.)

Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
---
lib/bootconfig.c | 2 +-
tools/bootconfig/samples/good-non-ascii.bconf | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
create mode 100644 tools/bootconfig/samples/good-non-ascii.bconf

diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 3ea601a2eba5..9f15b8bef3a0 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -466,7 +466,7 @@ static int __init __xbc_parse_value(char **__v, char **__n)
}
p = v - 1;
while ((c = *++p)) {
- if (!isprint(c) && !isspace(c))
+ if (c >= 0 && !isprint(c) && !isspace(c))
return xbc_parse_error("Non printable value", p);
if (quotes) {
if (c != quotes)
diff --git a/tools/bootconfig/samples/good-non-ascii.bconf b/tools/bootconfig/samples/good-non-ascii.bconf
new file mode 100644
index 000000000000..b6cb4c24fad6
--- /dev/null
+++ b/tools/bootconfig/samples/good-non-ascii.bconf
@@ -0,0 +1 @@
+hello.japanese = "ããããã"