Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Mar 2020 23:22:54 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r358794 - stable/11/sys/netpfil/pf
Message-ID:  <202003082322.028NMsua099493@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Sun Mar  8 23:22:54 2020
New Revision: 358794
URL: https://svnweb.freebsd.org/changeset/base/358794

Log:
  MFC r350468: 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.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/11/sys/netpfil/pf/pf_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/pf/pf_ioctl.c
==============================================================================
--- stable/11/sys/netpfil/pf/pf_ioctl.c	Sun Mar  8 23:22:18 2020	(r358793)
+++ stable/11/sys/netpfil/pf/pf_ioctl.c	Sun Mar  8 23:22:54 2020	(r358794)
@@ -3337,7 +3337,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?202003082322.028NMsua099493>