Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Mar 2020 23:22:19 +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-12@freebsd.org
Subject:   svn commit: r358793 - stable/12/sys/netpfil/pf
Message-ID:  <202003082322.028NMJtN099412@repo.freebsd.org>

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

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.
  
  Suggested by:	kp
  Sponsored by:	The FreeBSD Foundation

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

Modified: stable/12/sys/netpfil/pf/pf_ioctl.c
==============================================================================
--- stable/12/sys/netpfil/pf/pf_ioctl.c	Sun Mar  8 23:21:04 2020	(r358792)
+++ stable/12/sys/netpfil/pf/pf_ioctl.c	Sun Mar  8 23:22:18 2020	(r358793)
@@ -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?202003082322.028NMJtN099412>