mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
socket: fix invalid unix paths being used
This commit is contained in:
@@ -151,7 +151,11 @@ static inline int sock_convertaddress(sockaddr_t *sockaddr, abisockaddr_t *abiso
|
||||
break;
|
||||
case AF_LOCAL:
|
||||
unaddr_t *unaddr = (unaddr_t *)abisockaddr;
|
||||
strcpy(sockaddr->path, unaddr->sun_path);
|
||||
size_t length = strnlen(unaddr->sun_path, ABISOCKADDR_UN_MAX);
|
||||
if (length == ABISOCKADDR_UN_MAX)
|
||||
return EINVAL;
|
||||
|
||||
memcpy(sockaddr->path, unaddr->sun_path, length + 1);
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user