1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-08-26 17:50:11 +03:00

sd-dhcp-server: clear buffer before receive

I do not think this is necessary, but all other places in
libsystemd-network we clear buffer before receive. Without this,
Coverity warns about use-of-uninitialized-values.
Let's silence Coverity.

Closes CID#1469721.

(cherry picked from commit 40f9fa0af4c3094d93e833e62f7e301cd453da62)
(cherry picked from commit 0d573787ea1610ba57a359cf437841f62b186e77)
This commit is contained in:
Yu Watanabe
2024-06-12 00:48:56 +09:00
committed by Luca Boccassi
parent 0b5a399265
commit aa93c07b3a

View File

@ -1408,7 +1408,7 @@ static int server_receive_message(sd_event_source *s, int fd,
/* Preallocate the additional size for DHCP Relay Agent Information Option if needed */
buflen += relay_agent_information_length(server->agent_circuit_id, server->agent_remote_id) + 2;
message = malloc(buflen);
message = malloc0(buflen);
if (!message)
return -ENOMEM;