svn commit: r312053 - stable/11/contrib/bsnmp/snmpd
Ngie Cooper
ngie at FreeBSD.org
Fri Jan 13 09:04:28 UTC 2017
Author: ngie
Date: Fri Jan 13 09:04:26 2017
New Revision: 312053
URL: https://svnweb.freebsd.org/changeset/base/312053
Log:
MFC r311378:
lm_load: fix string copying issues
- Ensure `section` doesn't overrun section by using strlcpy instead of
strcpy [*].
- Use strdup instead of malloc + strcpy (this wasn't flagged by Coverity,
but is an opportunistic change).
CID: 1006826 [*]
Modified:
stable/11/contrib/bsnmp/snmpd/main.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/contrib/bsnmp/snmpd/main.c
==============================================================================
--- stable/11/contrib/bsnmp/snmpd/main.c Fri Jan 13 09:01:09 2017 (r312052)
+++ stable/11/contrib/bsnmp/snmpd/main.c Fri Jan 13 09:04:26 2017 (r312053)
@@ -2508,13 +2508,12 @@ lm_load(const char *path, const char *se
}
m->handle = NULL;
m->flags = 0;
- strcpy(m->section, section);
+ strlcpy(m->section, section, sizeof(m->section));
- if ((m->path = malloc(strlen(path) + 1)) == NULL) {
+ if ((m->path = strdup(path)) == NULL) {
syslog(LOG_ERR, "lm_load: %m");
goto err;
}
- strcpy(m->path, path);
/*
* Make index
More information about the svn-src-stable-11
mailing list