]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
logger: make sure path is terminated [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 3 Jan 2024 08:34:31 +0000 (09:34 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 3 Jan 2024 08:34:31 +0000 (09:34 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/logger.c

index 78103d21ec55d902d07184bd5f1bb11ef907c2a9..e1d270de8df6782bc5c801c185e6f53ea14e5e9b 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;
-       strncpy(s_addr.sun_path, path, sizeof(s_addr.sun_path));
+       xstrncpy(s_addr.sun_path, path, sizeof(s_addr.sun_path));
 
        for (i = 2; i; i--) {
                int st = -1;