ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Blob Blame History Raw
From 6f42877282a7237f3aa840403047b7cc18d7faa6 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Wed, 17 Sep 2014 19:07:56 +0200
Subject: [PATCH] libsystemd-network: dhcp-test - assert that malloc0 succeeds

Otherwise we would get a nullptr dereference later on.

Found by coverity. Fixes CID #1237655.
---
 src/libsystemd-network/test-dhcp-option.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libsystemd-network/test-dhcp-option.c b/src/libsystemd-network/test-dhcp-option.c
index 7a0fac8d33..63cdc7aa06 100644
--- a/src/libsystemd-network/test-dhcp-option.c
+++ b/src/libsystemd-network/test-dhcp-option.c
@@ -115,6 +115,7 @@ static DHCPMessage *create_message(uint8_t *options, uint16_t optlen,
         size_t len = sizeof(DHCPMessage) + optlen;
 
         message = malloc0(len);
+        assert_se(message);
 
         if (options && optlen)
                 memcpy(&message->options, options, optlen);