| Message ID | 20210402173414.14216-1-gert@greenie.muc.de |
|---|---|
| State | Accepted |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.27.255.50]) by backend30.mail.ord1d.rsapps.net with LMTP id 4N0TM+taZ2D5YwAAIUCqbw (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Fri, 02 Apr 2021 13:56:59 -0400 Received: from proxy14.mail.iad3a.rsapps.net ([172.27.255.50]) by director11.mail.ord1d.rsapps.net with LMTP id EPX5MutaZ2A4XQAAvGGmqA (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Fri, 02 Apr 2021 13:56:59 -0400 Received: from smtp50.gate.iad3a ([172.27.255.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy14.mail.iad3a.rsapps.net with LMTPS id SLSjHu1aZ2BEHQAA1+b4IQ (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Fri, 02 Apr 2021 13:57:01 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp50.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=greenie.muc.de X-Suspicious-Flag: YES X-Classification-ID: d12df3fa-93dc-11eb-bc81-525400c2fb51-1-1 Received: from [216.105.38.7] ([216.105.38.7:44000] helo=lists.sourceforge.net) by smtp50.gate.iad3a.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 43/03-17583-AEA57606; Fri, 02 Apr 2021 13:56:58 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1lSO1c-0001Q8-FO; Fri, 02 Apr 2021 17:56:04 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from <gert@blue.greenie.muc.de>) id 1lSO1Q-0001L0-KA for openvpn-devel@lists.sourceforge.net; Fri, 02 Apr 2021 17:55:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WcO9jMBynzrV9hawxijZkkMoxbHBZ21olkAwbwmBpRI=; b=L5EVHgBVA1pX8CiMmqUaRU8tse D6LY63MqVmrGzIt20kx+Po47Uxa8XK5nvPoJpSyg/87CsyoEovtBnefM/X2tG4Lb/CC/m9bfVsJXU aSJEkvCVueqPc5W61uC4oeu5vblgs4dczCg5Y2nQiADuhOjnJa44JyloytplwQdV8RyU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=WcO9jMBynzrV9hawxijZkkMoxbHBZ21olkAwbwmBpRI=; b=H XRPtIwSUswqLNELLQEurTb4jqvNjCJ2N2FZHjbLn44hGx/tewzTZqN7PHc+/hjFU+Dki0gPQCRux7 9pRLIH8XvKmp+DKBUjM6C5Q8i5nW2g1VWFaeub/bUYlKhsdCOyyCkuBRNszwxUFJ6B/WvGL1y0AeI QB1CUWq72IG1FNhs=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1lSNgg-007fSL-Rl for openvpn-devel@lists.sourceforge.net; Fri, 02 Apr 2021 17:34:51 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.15.2/8.14.9) with ESMTP id 132HYFQU014265 for <openvpn-devel@lists.sourceforge.net>; Fri, 2 Apr 2021 19:34:16 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.15.2/8.14.9/Submit) id 132HYFwr014264 for openvpn-devel@lists.sourceforge.net; Fri, 2 Apr 2021 19:34:15 +0200 From: Gert Doering <gert@greenie.muc.de> To: openvpn-devel@lists.sourceforge.net Date: Fri, 2 Apr 2021 19:34:14 +0200 Message-Id: <20210402173414.14216-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 TIME_LIMIT_EXCEEDED Exceeded time limit / deadline X-Headers-End: 1lSNgg-007fSL-Rl Subject: [Openvpn-devel] [PATCH] Fix potential NULL ptr crash if compiled with DMALLOC X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel] Fix potential NULL ptr crash if compiled with DMALLOC
|
|
Commit Message
Gert Doering
April 2, 2021, 6:34 a.m. UTC
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>
---
src/openvpn/buffer.c | 1 -
1 file changed, 1 deletion(-)
Comments
Hi, On 02/04/2021 19:34, Gert Doering wrote: > 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> > --- > src/openvpn/buffer.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c > index 48bf25d5..e7031a4f 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 > As discussed with Gert on IRC, we could rather add a "if (ret)" before doing memset. However the DMALLOC code path is barely tested at all and we don't want to introduce more changes than needed. So for now, we can live with this change. Acked-by: Antonio Quartulli <antonio@openvpn.net>
Patch has been applied to the master, release/2.5 and release/2.4 branch
(crazily important bugfix!).
commit e2acfad40c0d79ce7fd431c380d7466d383bcefa (master)
commit acf52dda9f4cb117e9d020dd06fccd7ecb90d303 (release/2.5)
commit a7263a125199c6d11710ecf50f9a07424369fdbc (release/2.4)
Author: Gert Doering
Date: Fri Apr 2 19:34:14 2021 +0200
Fix potential NULL ptr crash if compiled with DMALLOC
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>
--
kind regards,
Gert Doering
diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 48bf25d5..e7031a4f 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