mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 16:37:19 +09:00
core/exec-invoke: use strnpcpy() where appropriate (#39446)
This commit is contained in:
@@ -41,7 +41,7 @@ size_t strnpcpy_full(char **dest, size_t size, const char *src, size_t len, bool
|
||||
if (ret_truncated)
|
||||
*ret_truncated = truncated;
|
||||
|
||||
*dest[0] = '\0';
|
||||
(*dest)[0] = '\0';
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
#include "stat-util.h"
|
||||
#include "string-table.h"
|
||||
#include "strv.h"
|
||||
#include "strxcpyx.h"
|
||||
#include "terminal-util.h"
|
||||
#include "user-util.h"
|
||||
#include "utmp-wtmp.h"
|
||||
@@ -1504,7 +1505,7 @@ static void rename_process_from_path(const char *path) {
|
||||
size_t len = strlen(buf);
|
||||
char comm[TASK_COMM_LEN], *p = comm;
|
||||
*p++ = '(';
|
||||
p = mempcpy(p, buf + LESS_BY(len, (size_t) (TASK_COMM_LEN - 3)), MIN(len, (size_t) (TASK_COMM_LEN - 3)));
|
||||
strnpcpy(&p, TASK_COMM_LEN - 2, buf, len); /* strnpcpy() accounts for NUL byte internally */
|
||||
*p++ = ')';
|
||||
*p = '\0';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user