bhyve: guarantee NUL termination
Use strlcpy to guarantee NUL termination of the path to a virtio console socket. Reported by: Coverity CID: 1362874 Sponsored by: Dell EMC
This commit is contained in:
parent
054e6e1335
commit
8a114a66b5
@ -306,7 +306,7 @@ pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const char *name,
|
||||
sun.sun_family = AF_UNIX;
|
||||
sun.sun_len = sizeof(struct sockaddr_un);
|
||||
strcpy(pathcopy, path);
|
||||
strncpy(sun.sun_path, basename(pathcopy), sizeof(sun.sun_path));
|
||||
strlcpy(sun.sun_path, basename(pathcopy), sizeof(sun.sun_path));
|
||||
free(pathcopy);
|
||||
|
||||
if (bindat(fd, s, (struct sockaddr *)&sun, sun.sun_len) < 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user