|
|
304038 |
From 6b70da7e86ae17c215c48156a59e76b9f89e8add Mon Sep 17 00:00:00 2001
|
|
|
304038 |
From: Karel Zak <kzak@redhat.com>
|
|
|
304038 |
Date: Thu, 5 Oct 2017 11:07:41 +0200
|
|
|
304038 |
Subject: [PATCH 127/135] agetty: fix /etc/os-release parsing
|
|
|
304038 |
|
|
|
304038 |
For example /etc/os-release:
|
|
|
304038 |
|
|
|
304038 |
VERSION="26 (Twenty Six)"
|
|
|
304038 |
VERSION_ID=26
|
|
|
304038 |
|
|
|
304038 |
agetty for \S{VERSION} returns
|
|
|
304038 |
|
|
|
304038 |
_ID=26
|
|
|
304038 |
|
|
|
304038 |
because the parser does nor check for '=' after variable name.
|
|
|
304038 |
|
|
|
304038 |
Upstream: http://github.com/karelzak/util-linux/commit/949e83997906ab8dd8442f28d74c34bb5a2395ee
|
|
|
304038 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1498462
|
|
|
304038 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
304038 |
---
|
|
|
304038 |
term-utils/agetty.c | 6 ++++++
|
|
|
304038 |
1 file changed, 6 insertions(+)
|
|
|
304038 |
|
|
|
304038 |
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
|
|
|
304038 |
index 5692126dd..b626cdbeb 100644
|
|
|
304038 |
--- a/term-utils/agetty.c
|
|
|
304038 |
+++ b/term-utils/agetty.c
|
|
|
304038 |
@@ -1280,6 +1280,7 @@ static char *xgetdomainname(void)
|
|
|
304038 |
return NULL;
|
|
|
304038 |
}
|
|
|
304038 |
|
|
|
304038 |
+
|
|
|
304038 |
static char *read_os_release(struct options *op, const char *varname)
|
|
|
304038 |
{
|
|
|
304038 |
int fd = -1;
|
|
|
304038 |
@@ -1329,6 +1330,11 @@ static char *read_os_release(struct options *op, const char *varname)
|
|
|
304038 |
continue;
|
|
|
304038 |
}
|
|
|
304038 |
p += varsz;
|
|
|
304038 |
+ p += strspn(p, " \t\n\r");
|
|
|
304038 |
+
|
|
|
304038 |
+ if (*p != '=')
|
|
|
304038 |
+ continue;
|
|
|
304038 |
+
|
|
|
304038 |
p += strspn(p, " \t\n\r=\"");
|
|
|
304038 |
eol = p + strcspn(p, "\n\r");
|
|
|
304038 |
*eol = '\0';
|
|
|
304038 |
--
|
|
|
304038 |
2.13.6
|
|
|
304038 |
|