diff options
author | Karel Zak | 2017-10-05 11:07:41 +0200 |
---|---|---|
committer | Karel Zak | 2017-10-05 11:07:41 +0200 |
commit | 949e83997906ab8dd8442f28d74c34bb5a2395ee (patch) | |
tree | a76257f8a57dfb902d108af3f2deff514d955394 /term-utils | |
parent | docs: (TODO) make PMBR boot flag more user-friendly (diff) | |
download | kernel-qcow2-util-linux-949e83997906ab8dd8442f28d74c34bb5a2395ee.tar.gz kernel-qcow2-util-linux-949e83997906ab8dd8442f28d74c34bb5a2395ee.tar.xz kernel-qcow2-util-linux-949e83997906ab8dd8442f28d74c34bb5a2395ee.zip |
agetty: fix /etc/os-release parsing
For example /etc/os-release:
VERSION="26 (Twenty Six)"
VERSION_ID=26
agetty for \S{VERSION} returns
_ID=26
because the parser does nor check for '=' after variable name.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1498462
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils')
-rw-r--r-- | term-utils/agetty.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 956e8af97..ee66a3948 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -1438,6 +1438,7 @@ static char *xgetdomainname(void) #endif } + static char *read_os_release(struct options *op, const char *varname) { int fd = -1; @@ -1490,6 +1491,11 @@ static char *read_os_release(struct options *op, const char *varname) continue; } p += varsz; + p += strspn(p, " \t\n\r"); + + if (*p != '=') + continue; + p += strspn(p, " \t\n\r=\""); eol = p + strcspn(p, "\n\r"); *eol = '\0'; |