]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp-server: clear buffer before receive
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 11 Jun 2024 15:48:56 +0000 (00:48 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 11 Jun 2024 23:06:46 +0000 (00:06 +0100)
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.

src/libsystemd-network/sd-dhcp-server.c

index c3b0f82dc4f87dfd4a69446241d636f888b54d01..4967f066dce5f8901df7e324c20cc414cb202fdf 100644 (file)
@@ -1252,7 +1252,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;