A tiling window manager

communication: Ensure string termination after strncpy

authored by

joveian and committed by
GitHub
358d0b45 37f1a94f

+4 -2
+4 -2
communications.c
··· 60 60 rp_glob_screen.control_socket_path); 61 61 62 62 strncpy(sun.sun_path, rp_glob_screen.control_socket_path, 63 - sizeof(sun.sun_path)); 63 + sizeof(sun.sun_path)-1); 64 + sun.sun_path[sizeof(sun.sun_path) - 1] = '\0'; 64 65 sun.sun_family = AF_UNIX; 65 66 66 67 if (unlink(rp_glob_screen.control_socket_path) == -1 && ··· 113 114 rp_glob_screen.control_socket_path); 114 115 115 116 strncpy(sun.sun_path, rp_glob_screen.control_socket_path, 116 - sizeof(sun.sun_path)); 117 + sizeof(sun.sun_path)-1); 118 + sun.sun_path[sizeof(sun.sun_path) - 1] = '\0'; 117 119 sun.sun_family = AF_UNIX; 118 120 119 121 if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1)