Header Alignment Cleanups
[lttng-tools.git] / liblttsessiondcomm / liblttsessiondcomm.c
index 29678240106b55182b98d73d1ba8122a70dc281f..cecd89d6a5815fc7ee1e472821474afc4785dc39 100644 (file)
@@ -127,6 +127,7 @@ int lttcomm_connect_unix_sock(const char *pathname)
        memset(&sun, 0, sizeof(sun));
        sun.sun_family = AF_UNIX;
        strncpy(sun.sun_path, pathname, sizeof(sun.sun_path));
+       sun.sun_path[sizeof(sun.sun_path) - 1] = '\0';
 
        ret = connect(fd, (struct sockaddr *) &sun, sizeof(sun));
        if (ret < 0) {
@@ -191,7 +192,8 @@ int lttcomm_create_unix_sock(const char *pathname)
 
        memset(&sun, 0, sizeof(sun));
        sun.sun_family = AF_UNIX;
-       strncpy(sun.sun_path, pathname, strlen(pathname));
+       strncpy(sun.sun_path, pathname, sizeof(sun.sun_path));
+       sun.sun_path[sizeof(sun.sun_path) - 1] = '\0';
 
        /* Unlink the old file if present */
        (void) unlink(pathname);
This page took 0.022817 seconds and 4 git commands to generate.