efi-string: Unquote single-quoted strings as well as double

This code is used to read data copied from /etc/os-release. According to
the spec[1], values can be enclosed in single quotes or double quotes.
Not handling single quotes results in the quotes appearing in the
systemd-boot menu, e.g. 'Gentoo Linux'.

[1] https://www.freedesktop.org/software/systemd/man/latest/os-release.html

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This commit is contained in:
James Le Cuirot
2026-02-04 23:58:06 +09:00
committed by Yu Watanabe
parent b3d73bc68e
commit a8f2f5d717
+2 -1
View File
@@ -497,7 +497,8 @@ char* line_get_key_value(char *s, const char *sep, size_t *pos, char **ret_key,
value++;
/* unquote */
if (value[0] == '"' && line[linelen - 1] == '"') {
if ((value[0] == '"' && line[linelen - 1] == '"') ||
(value[0] == '\'' && line[linelen - 1] == '\'')) {
value++;
line[linelen - 1] = '\0';
}