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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to