Author: tuexen
Date: Tue Oct  8 11:07:16 2019
New Revision: 353303
URL: https://svnweb.freebsd.org/changeset/base/353303

Log:
  Validate length before use it, not vice versa.
  r353060 should have contained this...
  This fixes
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18070
  MFC after:            3 days

Modified:
  head/sys/netinet/sctp_asconf.c

Modified: head/sys/netinet/sctp_asconf.c
==============================================================================
--- head/sys/netinet/sctp_asconf.c      Tue Oct  8 11:06:24 2019        
(r353302)
+++ head/sys/netinet/sctp_asconf.c      Tue Oct  8 11:07:16 2019        
(r353303)
@@ -334,11 +334,11 @@ sctp_process_asconf_delete_ip(struct sockaddr *src,
 #endif
 
        aparam_length = ntohs(aph->ph.param_length);
-       ph = (struct sctp_paramhdr *)(aph + 1);
-       param_type = ntohs(ph->param_type);
        if (aparam_length < sizeof(struct sctp_asconf_paramhdr) + sizeof(struct 
sctp_paramhdr)) {
                return (NULL);
        }
+       ph = (struct sctp_paramhdr *)(aph + 1);
+       param_type = ntohs(ph->param_type);
 #if defined(INET) || defined(INET6)
        param_length = ntohs(ph->param_length);
        if (param_length + sizeof(struct sctp_asconf_paramhdr) != 
aparam_length) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to