]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
src/openvpn/dco_freebsd.c: handle malloc failure
authorIlya Shipitsin <chipitsine@gmail.com>
Thu, 18 May 2023 21:21:39 +0000 (23:21 +0200)
committerGert Doering <gert@greenie.muc.de>
Fri, 19 May 2023 06:25:44 +0000 (08:25 +0200)
malloc was not checked against NULL, I was able
to get core dump in case of failure

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20230518212139.1261-1-chipitsine@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26707.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/dco_freebsd.c

index 1111abebdc48e3ddac1bf77c07aea3cb92f0ce0a..af7776bb8de42edabac2e0607c8898a5b7d35ab2 100644 (file)
@@ -594,6 +594,10 @@ dco_available(int msglevel)
     }
 
     buf = malloc(ifcr.ifcr_total * IFNAMSIZ);
+    if (!buf)
+    {
+        goto out;
+    }
 
     ifcr.ifcr_count = ifcr.ifcr_total;
     ifcr.ifcr_buffer = buf;