From: Gert Doering Date: Fri, 2 Apr 2021 17:34:14 +0000 (+0200) Subject: Fix potential NULL ptr crash if compiled with DMALLOC X-Git-Tag: v2.6_beta1~556 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e2acfad40c0d79ce7fd431c380d7466d383bcefa;p=thirdparty%2Fopenvpn.git Fix potential NULL ptr crash if compiled with DMALLOC In the unlikely case that we are compiled with -DDMALLOC *and* malloc() returns NULL, there is an uncaught memset() which would crash then. Remove the memset(), as the right the next operation after check_malloc_return() is a mempcy() which will overwrite the whole memory block anyway. Trac: #586 Signed-off-by: Gert Doering Acked-by: Antonio Quartulli Message-Id: <20210402173414.14216-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21981.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 48bf25d53..e7031a4fd 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -706,7 +706,6 @@ string_alloc(const char *str, struct gc_arena *gc) */ #ifdef DMALLOC ret = openvpn_dmalloc(file, line, n); - memset(ret, 0, n); #else ret = calloc(1, n); #endif