Fix strncpy() buffer size compiler warnings
This commit is contained in:
parent
ca06f34eed
commit
b2d3d3e03f
4 changed files with 6 additions and 6 deletions
|
@ -27,7 +27,7 @@ patty_client *patty_client_new(const char *path) {
|
||||||
|
|
||||||
memset(&addr, '\0', sizeof(addr));
|
memset(&addr, '\0', sizeof(addr));
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
strncpy(addr.sun_path, path, sizeof(addr.sun_path));
|
strncpy(addr.sun_path, path, sizeof(addr.sun_path)-1);
|
||||||
|
|
||||||
if (connect(client->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
if (connect(client->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||||
goto error_connect;
|
goto error_connect;
|
||||||
|
|
|
@ -191,7 +191,7 @@ patty_kiss_tnc *patty_kiss_tnc_new(const char *device) {
|
||||||
|
|
||||||
memset(&addr, '\0', sizeof(addr));
|
memset(&addr, '\0', sizeof(addr));
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
strncpy(addr.sun_path, device, sizeof(addr.sun_path));
|
strncpy(addr.sun_path, device, sizeof(addr.sun_path)-1);
|
||||||
|
|
||||||
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||||
goto error_connect;
|
goto error_connect;
|
||||||
|
|
|
@ -46,7 +46,7 @@ patty_ax25_server *patty_ax25_server_new(const char *path) {
|
||||||
|
|
||||||
memset(server, '\0', sizeof(*server));
|
memset(server, '\0', sizeof(*server));
|
||||||
|
|
||||||
strncpy(server->path, path, PATTY_AX25_SOCK_PATH_SIZE);
|
strncpy(server->path, path, sizeof(server->path)-1);
|
||||||
|
|
||||||
if ((server->ifaces = patty_list_new()) == NULL) {
|
if ((server->ifaces = patty_list_new()) == NULL) {
|
||||||
goto error_list_new_ifaces;
|
goto error_list_new_ifaces;
|
||||||
|
@ -523,7 +523,7 @@ static int respond_accept(int client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
strncpy(response.path, path, sizeof(response.path));
|
strncpy(response.path, path, sizeof(response.path)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return write(client, &response, sizeof(response));
|
return write(client, &response, sizeof(response));
|
||||||
|
@ -957,7 +957,7 @@ static int listen_unix(patty_ax25_server *server, const char *path) {
|
||||||
|
|
||||||
memset(&addr, '\0', sizeof(addr));
|
memset(&addr, '\0', sizeof(addr));
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
strncpy(addr.sun_path, path, sizeof(addr.sun_path));
|
strncpy(addr.sun_path, path, sizeof(addr.sun_path)-1);
|
||||||
|
|
||||||
if (bind(server->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
if (bind(server->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||||
goto error_bind;
|
goto error_bind;
|
||||||
|
|
|
@ -30,7 +30,7 @@ static int bind_pty(patty_ax25_sock *sock) {
|
||||||
goto error_ptsname;
|
goto error_ptsname;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)strncpy(sock->pty, pty, sizeof(sock->pty));
|
(void)strncpy(sock->pty, pty, sizeof(sock->pty)-1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue