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

Reply via email to