mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
Net: Fix initializing sockaddr_un.sun_path copy buffers
The whole point of allocating an extra byte for the null terminator is to initialize it to zero.
This commit is contained in:
parent
43ce6c5474
commit
908068d19d
1 changed files with 2 additions and 2 deletions
|
@ -48,7 +48,7 @@ KResult LocalSocket::bind(const sockaddr* address, socklen_t address_size)
|
|||
return KResult(-EINVAL);
|
||||
|
||||
const sockaddr_un& local_address = *reinterpret_cast<const sockaddr_un*>(address);
|
||||
char safe_address[sizeof(local_address.sun_path) + 1];
|
||||
char safe_address[sizeof(local_address.sun_path) + 1] = { 0 };
|
||||
memcpy(safe_address, local_address.sun_path, sizeof(local_address.sun_path));
|
||||
|
||||
#ifdef DEBUG_LOCAL_SOCKET
|
||||
|
@ -81,7 +81,7 @@ KResult LocalSocket::connect(FileDescription& description, const sockaddr* addre
|
|||
return KResult(-EINVAL);
|
||||
|
||||
const sockaddr_un& local_address = *reinterpret_cast<const sockaddr_un*>(address);
|
||||
char safe_address[sizeof(local_address.sun_path) + 1];
|
||||
char safe_address[sizeof(local_address.sun_path) + 1] = { 0 };
|
||||
memcpy(safe_address, local_address.sun_path, sizeof(local_address.sun_path));
|
||||
|
||||
#ifdef DEBUG_LOCAL_SOCKET
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue