freebsd-dev/contrib/bsnmp/snmp_mibII
Enji Cooper 02ff676c4d MIB-II: use strlcpy when copying interface names to .ifr_name
.ifra_name is assumed to be NUL terminated; using strlcpy(3)
ensures that it's indeed NUL terminated whereas strncpy does
not.

Tested and verified as follows with a combination of ifconfig,
snmpget, and snmpset:

  % ifconfig create lo1 127.0.0.2/8
  % SNMPARGS="-v 3 -n '' -u bsnmp -A bsnmptest -l authPriv -a sha -x des -X bsnmptest localhost"
  % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
  IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
  % snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 2
  IF-MIB::ifAdminStatus.4 = INTEGER: down(2)
  % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
  IF-MIB::ifAdminStatus.4 = INTEGER: down(2)
  % snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 1
  IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
  % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
  IF-MIB::ifAdminStatus.4 = INTEGER: up(1)

MFC after:	2 weeks
Reported by:	Coverity
CID:		1009652-1009656, 1349850
2016-12-31 11:50:36 +00:00
..
BEGEMOT-IP-MIB.txt
BEGEMOT-MIB2-MIB.txt Fix a problem with high CPU consumption (up to 30%) by bsnmpd on a loaded system. 2009-12-03 16:08:00 +00:00
mibII_begemot.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_ifmib.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_ifstack.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_interfaces.c MIB-II: use strlcpy when copying interface names to .ifr_name 2016-12-31 11:50:36 +00:00
mibII_ip.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_ipaddr.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_nettomedia.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_rcvaddr.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_route.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_tcp.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_tree.def style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII_udp.c style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
mibII.c MIB-II: use strlcpy when copying interface names to .ifr_name 2016-12-31 11:50:36 +00:00
mibII.h style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
snmp_mibII.3 style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00
snmp_mibII.h style(9): clean up trailing whitespace 2016-12-27 23:32:54 +00:00