Opened 2 years ago

Last modified 14 months ago

#586 assigned Patch submission

Possible Segmentation Fault issue in OpenVPN 2.3.x

Reported by: dogbert2 Owned by: dazo
Priority: major Milestone: release 2.3.14
Component: Generic / unclassified Version: OpenVPN 2.3.5 (Community Ed)
Severity: Not set (select this one, unless your'e a OpenVPN developer) Keywords: Possible Segmentation Violation/Fault
Cc: dazo

Description

Hello All,

In reviewing code in OpenVPN 2.3.6, I found in file 'buffer.c'

if DMALLOC is defined, at line 553, where ret = openvpn_dmalloc
(file, line, n) which is a call to malloc() in the memdbg.h file
where it appears to reference malloc(). In the case where NULL
is returned to variable 'ret', in this case, a call to memset()
with variable 'ret' equal to NULL, which will result in a
segmentation violation/fault.

The patch file below should address this issue:

--- buffer.c.orig 2015-07-31 23:03:56.265948284 -0400
+++ buffer.c 2015-07-31 23:05:21.439948284 -0400
@@ -554,6 +554,7 @@

*/

#ifdef DMALLOC

ret = openvpn_dmalloc (file, line, n);

+ check_malloc_return(ret);

memset(ret, 0, n);

#else

ret = calloc(1, n);


Comments, Questions, Suggestions, Complaints? :)

I am attaching the patch file to this bug report...

Bill Parker (wp02855 at gmail dot com)

Attachments (1)

buffer.c.patch (292 bytes) - added by dogbert2 2 years ago.
Patch file for ticket 586

Download all attachments as: .zip

Change History (5)

Changed 2 years ago by dogbert2

Patch file for ticket 586

comment:1 Changed 2 years ago by cron2

  • Cc dazo added
  • Milestone set to release 2.3.8

It's a somewhat unlikely case and would need an actual DMALLOC build to be risky - but still, as long as we're not sure that dmalloc_malloc() (which openvpn_dmalloc() maps to) never returns NULL, needs fixing...

The problematic code was introduced in commit dc7be6d0, part of a series of ambitious but not well-understood-enough cleanup changes.

comment:2 Changed 2 years ago by cron2

  • Milestone changed from release 2.3.8 to release 2.3.9

comment:3 Changed 20 months ago by samuli

  • Milestone changed from release 2.3.9 to release 2.3.12

comment:4 Changed 14 months ago by cron2

  • Milestone changed from release 2.3.12 to release 2.3.14
  • Owner set to dazo
  • Status changed from new to assigned

either we rip out DMALLOC or we fix it :)

Note: See TracTickets for help on using tickets.