Author: markj
Date: Tue Dec  1 15:11:16 2020
New Revision: 368232
URL: https://svnweb.freebsd.org/changeset/base/368232

Log:
  MFC r367987:
  pf: Make tag hashing more robust

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 Tue Dec  1 15:09:02 2020        
(r368231)
+++ stable/12/sys/netpfil/pf/pf_ioctl.c Tue Dec  1 15:11:16 2020        
(r368232)
@@ -513,8 +513,10 @@ pf_cleanup_tagset(struct pf_tagset *ts)
 static uint16_t
 tagname2hashindex(const struct pf_tagset *ts, const char *tagname)
 {
+       size_t len;
 
-       return (murmur3_32_hash(tagname, strlen(tagname), ts->seed) & ts->mask);
+       len = strnlen(tagname, PF_TAG_NAME_SIZE - 1);
+       return (murmur3_32_hash(tagname, len, ts->seed) & ts->mask);
 }
 
 static uint16_t
_______________________________________________
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