svn commit: r315613 - stable/9/contrib/bsnmp/snmpd

Ngie Cooper ngie at FreeBSD.org
Mon Mar 20 03:18:17 UTC 2017


Author: ngie
Date: Mon Mar 20 03:18:16 2017
New Revision: 315613
URL: https://svnweb.freebsd.org/changeset/base/315613

Log:
  MFC r315206:
  
  bsnmpd: fix segfault when trans_insert_port(..) is called with multiple
  out of order addresses
  
  Move `port->transport` initialization before the TAILQ_FOREACH(..) loop
  to ensure that the value is properly initialized before it's inserted
  into the TAILQ.
  
  PR:		217760

Modified:
  stable/9/contrib/bsnmp/snmpd/main.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/bsnmp/   (props changed)

Modified: stable/9/contrib/bsnmp/snmpd/main.c
==============================================================================
--- stable/9/contrib/bsnmp/snmpd/main.c	Mon Mar 20 03:13:03 2017	(r315612)
+++ stable/9/contrib/bsnmp/snmpd/main.c	Mon Mar 20 03:18:16 2017	(r315613)
@@ -771,13 +771,13 @@ trans_insert_port(struct transport *t, s
 {
 	struct tport *p;
 
+	port->transport = t;
 	TAILQ_FOREACH(p, &t->table, link) {
 		if (asn_compare_oid(&p->index, &port->index) > 0) {
 			TAILQ_INSERT_BEFORE(p, port, link);
 			return;
 		}
 	}
-	port->transport = t;
 	TAILQ_INSERT_TAIL(&t->table, port, link);
 }
 


More information about the svn-src-stable-9 mailing list