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 MFC after: 1 week Reported by: Coverity CID: 1006827, 1006828
This commit is contained in:
parent
02ff676c4d
commit
a0e0e1ffa5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310952
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user