]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi-string: Unquote single-quoted strings as well as double
authorJames Le Cuirot <jlecuirot@microsoft.com>
Tue, 27 Jan 2026 17:12:34 +0000 (17:12 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 27 Feb 2026 20:05:57 +0000 (20:05 +0000)
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>
(cherry picked from commit a8f2f5d71786c2cf36e32f856cc329413a76cd93)
(cherry picked from commit 7177a0c4342368a62eda4094cc357ce15ae5c5bc)
(cherry picked from commit aee4efbcba69bd1abf752e465ecfd04c3d1479a2)

src/boot/efi-string.c

index 3c4cb585f0df2ff7d636df888a1fe838006ac6ff..5f3ea9fc3a38ac62889b698bc3b9a19947e899c7 100644 (file)
@@ -470,7 +470,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';
                 }