aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGert Doering2021-04-02 19:34:14 +0200
committerGert Doering2021-04-04 10:57:55 +0200
commita7263a125199c6d11710ecf50f9a07424369fdbc (patch)
tree35f6cb427af0cd02bb8193465649f93a06954d68
parent5b17607ad593bc081dc35b2ed1d6b852786a0d23 (diff)
downloadopenvpn-a7263a125199c6d11710ecf50f9a07424369fdbc.zip
openvpn-a7263a125199c6d11710ecf50f9a07424369fdbc.tar.gz
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 <gert@greenie.muc.de> Acked-by: Antonio Quartulli <antonio@openvpn.net> 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 <gert@greenie.muc.de> (cherry picked from commit e2acfad40c0d79ce7fd431c380d7466d383bcefa)
-rw-r--r--src/openvpn/buffer.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index f9c76b1..13d68d4 100644
--- a/src/openvpn/buffer.c
+++ b/src/openvpn/buffer.c
@@ -647,7 +647,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