[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250822142215.2475014-3-dhowells@redhat.com>
Date: Fri, 22 Aug 2025 15:22:09 +0100
From: David Howells <dhowells@...hat.com>
To: Jarkko Sakkinen <jarkko@...nel.org>
Cc: David Howells <dhowells@...hat.com>,
keyrings@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/7] request-key: Fix mishandling of last line of config file
Fix mishandling of the config file by /sbin/request-key whereby the last
line of a file, if it is lacking a newline, will trim off the last
character and then try and use that. Return an error instead if we find a
line without a newline char at the end.
Signed-off-by: David Howells <dhowells@...hat.com>
---
request-key.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/request-key.c b/request-key.c
index bf47c0a..d1feec3 100644
--- a/request-key.c
+++ b/request-key.c
@@ -367,6 +367,8 @@ static void scan_conf_file(struct parameters *params, int dirfd, const char *con
/* ignore blank lines and comments */
if (len == 1 || buf[0] == '#' || isspace(buf[0]))
continue;
+ if (len == 0 || buf[len - 1] != '\n')
+ line_error("Line missing newline\n");
buf[--len] = 0;
p = buf;
Powered by blists - more mailing lists