1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-09 01:18:39 +03:00

strcpy -> strncpy in common daemon code.

This commit is contained in:
Peter Rajnoha 2012-04-10 12:55:37 +00:00
parent fb4f76a29c
commit 48511e9bd6
2 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ daemon_handle daemon_open(daemon_info i) {
goto error;
memset(&sockaddr, 0, sizeof(sockaddr));
strcpy(sockaddr.sun_path, i.socket);
strncpy(sockaddr.sun_path, i.socket, sizeof(sockaddr.sun_path));
sockaddr.sun_family = AF_UNIX;
if (connect(h.socket_fd,(struct sockaddr *) &sockaddr, sizeof(sockaddr)))
goto error;

View File

@ -224,7 +224,7 @@ static int _open_socket(daemon_state s)
fprintf(stderr, "[D] creating %s\n", s.socket_path);
memset(&sockaddr, 0, sizeof(sockaddr));
strcpy(sockaddr.sun_path, s.socket_path);
strncpy(sockaddr.sun_path, s.socket_path, sizeof(sockaddr.sun_path));
sockaddr.sun_family = AF_UNIX;
if (bind(fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr))) {