diff options
author | ngie <ngie@FreeBSD.org> | 2017-01-07 08:54:02 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-01-07 08:54:02 +0000 |
commit | b735cb7edadcdc14bb6aa4ef1157f876dbefe7fe (patch) | |
tree | 1292983d442a9d9c73f9a4c237f85603afd8694b /contrib/bsnmp | |
parent | e7482bc1d4714d175bbbf7b05a49997db377de97 (diff) | |
download | FreeBSD-src-b735cb7edadcdc14bb6aa4ef1157f876dbefe7fe.zip FreeBSD-src-b735cb7edadcdc14bb6aa4ef1157f876dbefe7fe.tar.gz |
MFC r310952:
MIB-II: use strlcpy instead of strcpy when copying {descr,name}
This is of course to avoid buffer overruns
The remaining strcpy instance in the module needs to be audited for
correctness
CID: 1006827, 1006828
Diffstat (limited to 'contrib/bsnmp')
-rw-r--r-- | contrib/bsnmp/snmp_mibII/mibII.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/bsnmp/snmp_mibII/mibII.c b/contrib/bsnmp/snmp_mibII/mibII.c index a105398..85c61d5 100644 --- a/contrib/bsnmp/snmp_mibII/mibII.c +++ b/contrib/bsnmp/snmp_mibII/mibII.c @@ -204,7 +204,7 @@ mib_if_set_dyn(const char *name) return; if ((d = malloc(sizeof(*d))) == NULL) err(1, NULL); - strcpy(d->name, name); + strlcpy(d->name, name, sizeof(d->name)); SLIST_INSERT_HEAD(&mibdynif_list, d, link); } @@ -774,8 +774,8 @@ mibif_create(u_int sysindex, const char *name) memset(ifp->private, 0, sizeof(struct mibif_private)); ifp->sysindex = sysindex; - strcpy(ifp->name, name); - strcpy(ifp->descr, name); + strlcpy(ifp->name, name, sizeof(ifp->name)); + strlcpy(ifp->descr, name, sizeof(ifp->descr)); ifp->spec_oid = oid_zeroDotZero; map = NULL; |