]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
logger: use strncpy instead of strcpy
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 24 Dec 2023 13:12:52 +0000 (14:12 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 31 Dec 2023 12:04:23 +0000 (13:04 +0100)
This is not strictly necessary but better style.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
misc-utils/logger.c

index 980412bebba7927cf8238d9f94339f907493cd13..78103d21ec55d902d07184bd5f1bb11ef907c2a9 100644 (file)
@@ -248,7 +248,7 @@ static int unix_socket(struct logger_ctl *ctl, const char *path, int *socket_typ
                errx(EXIT_FAILURE, _("openlog %s: pathname too long"), path);
 
        s_addr.sun_family = AF_UNIX;
-       strcpy(s_addr.sun_path, path);
+       strncpy(s_addr.sun_path, path, sizeof(s_addr.sun_path));
 
        for (i = 2; i; i--) {
                int st = -1;