]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r310950:
authorngie <ngie@FreeBSD.org>
Sat, 14 Jan 2017 00:24:44 +0000 (00:24 +0000)
committerngie <ngie@FreeBSD.org>
Sat, 14 Jan 2017 00:24:44 +0000 (00:24 +0000)
commited40afe5519d7894d2af8745f165f9c19f403012
tree443da7ad37c0e052b61a7aeb82f9a686a471e955
parent2d85da818d0d629ec1ed3fb4f7442e32f232d0b2
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
contrib/bsnmp/snmp_mibII/mibII.c
contrib/bsnmp/snmp_mibII/mibII_interfaces.c