]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r310950:
authorngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 14 Jan 2017 00:24:46 +0000 (00:24 +0000)
committerngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 14 Jan 2017 00:24:46 +0000 (00:24 +0000)
commitd7efcab3686500cd42469eb411d2315e9084f8c8
tree01e3b55b6aaa97d07d204f4b92fcd7b5e020a797
parentb5a5194e2f2b91945e589f9a29b6c380e1ffeb33
MFC r310950:

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)

CID: 1009652-10096561349850

git-svn-id: svn://svn.freebsd.org/base/stable/10@312089 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
contrib/bsnmp/snmp_mibII/mibII.c
contrib/bsnmp/snmp_mibII/mibII_interfaces.c