mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-26 20:26:53 +00:00
LibC: strcpy a socket address at compile time
This way, we'd get compile-time errors if the address was too long for the buffer.
This commit is contained in:
parent
852454746e
commit
0817ef563e
Notes:
sideshowbarker
2024-07-19 02:59:32 +09:00
Author: https://github.com/bugaevc
Commit: 0817ef563e
Pull-request: https://github.com/SerenityOS/serenity/pull/3296
Reviewed-by: https://github.com/BenWiederhake
Reviewed-by: https://github.com/alimpfard
1 changed files with 4 additions and 3 deletions
|
@ -82,9 +82,10 @@ static int connect_to_lookup_server()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sockaddr_un address;
|
sockaddr_un address {
|
||||||
address.sun_family = AF_LOCAL;
|
AF_LOCAL,
|
||||||
strlcpy(address.sun_path, "/tmp/portal/lookup", sizeof(address.sun_path));
|
"/tmp/portal/lookup"
|
||||||
|
};
|
||||||
|
|
||||||
if (connect(fd, (const sockaddr*)&address, sizeof(address)) < 0) {
|
if (connect(fd, (const sockaddr*)&address, sizeof(address)) < 0) {
|
||||||
perror("connect_to_lookup_server");
|
perror("connect_to_lookup_server");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue