Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jul 2019 16:58:10 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350468 - head/sys/netpfil/pf
Message-ID:  <201907311658.x6VGwADZ066739@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Wed Jul 31 16:58:09 2019
New Revision: 350468
URL: https://svnweb.freebsd.org/changeset/base/350468

Log:
  pf: zero (another) output buffer in pfioctl
  
  Avoid potential structure padding leak.  r350294 identified a leak via
  static analysis; although there's no report of a leak with the
  DIOCGETSRCNODES ioctl it's a good practice to zero the memory.
  
  Suggested by:	kp
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==============================================================================
--- head/sys/netpfil/pf/pf_ioctl.c	Wed Jul 31 16:22:05 2019	(r350467)
+++ head/sys/netpfil/pf/pf_ioctl.c	Wed Jul 31 16:58:09 2019	(r350468)
@@ -3752,7 +3752,7 @@ DIOCCHANGEADDR_error:
 
 		nr = 0;
 
-		p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK);
+		p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK | M_ZERO);
 		for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask;
 		    i++, sh++) {
 		    PF_HASHROW_LOCK(sh);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907311658.x6VGwADZ066739>