From: Daan De Meyer Date: Thu, 9 May 2024 10:32:31 +0000 (+0200) Subject: Fix ul_path_read_buffer() X-Git-Tag: v2.42-start~351^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6273c12257973cbd3c59a710049ee8a8027bbbb1;p=thirdparty%2Futil-linux.git Fix ul_path_read_buffer() The current implementation cuts off the last character of the buffer if there is no trailing newline. --- diff --git a/lib/path.c b/lib/path.c index 202f19ac4..f897599fd 100644 --- a/lib/path.c +++ b/lib/path.c @@ -682,7 +682,7 @@ int ul_path_read_buffer(struct path_cxt *pc, char *buf, size_t bufsz, const char if (*(buf + rc - 1) == '\n') buf[--rc] = '\0'; else - buf[rc - 1] = '\0'; + buf[rc] = '\0'; } return rc;