Author: kp
Date: Fri Apr 24 15:27:55 2020
New Revision: 360267
URL: https://svnweb.freebsd.org/changeset/base/360267

Log:
  MFC r360042:
  
  pf: Do not allow negative ps_len in DIOCGETSTATES
  
  Userspace may pass a negative ps_len value to us, which causes an
  assertion failure in malloc().
  Treat negative values as zero, i.e. return the required size.
  
  Reported-by:  syzbot+53370d9d0358ee2a0...@syzkaller.appspotmail.com

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 Fri Apr 24 15:09:30 2020        
(r360266)
+++ stable/12/sys/netpfil/pf/pf_ioctl.c Fri Apr 24 15:27:55 2020        
(r360267)
@@ -2163,7 +2163,7 @@ relock_DIOCKILLSTATES:
                struct pfsync_state     *pstore, *p;
                int i, nr;
 
-               if (ps->ps_len == 0) {
+               if (ps->ps_len <= 0) {
                        nr = uma_zone_get_cur(V_pf_state_z);
                        ps->ps_len = sizeof(struct pfsync_state) * nr;
                        break;
_______________________________________________
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