Skip to content

Commit

Permalink
Merge pull request #187 from flaviojs/fix-buffer-overflow-netio_unix_…
Browse files Browse the repository at this point in the history
…create_socket

Fix buffer overflow in netio_unix_create_socket.
  • Loading branch information
grossmj authored Mar 26, 2024
2 parents ebe67ce + b5184f7 commit efc2b60
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ static int netio_unix_create_socket(netio_unix_desc_t *nud)

memset(&local_sock,0,sizeof(local_sock));
local_sock.sun_family = AF_UNIX;
strcpy(local_sock.sun_path,nud->local_filename);
strncpy(local_sock.sun_path,nud->local_filename, sizeof(local_sock.sun_path) - 1);
local_sock.sun_path[sizeof(local_sock.sun_path) - 1] = '\0';

if (bind(nud->fd,(struct sockaddr *)&local_sock,sizeof(local_sock)) == -1) {
perror("netio_unix: bind");
Expand Down

0 comments on commit efc2b60

Please sign in to comment.