Fix parsing when "file <filename>" directive is used in snmpd.conf
without maxfilesize column.
This commit is contained in:
parent
25df151652
commit
db95497bd3
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=96594
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= net-snmp
|
||||
PORTVERSION= 5.1
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
|
||||
MASTER_SITE_SUBDIR= net-snmp
|
||||
|
24
net-mgmt/net-snmp-devel/files/patch-file.c
Normal file
24
net-mgmt/net-snmp-devel/files/patch-file.c
Normal file
@ -0,0 +1,24 @@
|
||||
--- agent/mibgroup/ucd-snmp/file.c.orig Thu Dec 25 23:57:14 2003
|
||||
+++ agent/mibgroup/ucd-snmp/file.c Thu Dec 25 23:57:37 2003
|
||||
@@ -91,17 +91,19 @@
|
||||
file_parse_config(const char *token, char *cptr)
|
||||
{
|
||||
char space;
|
||||
+ int items;
|
||||
|
||||
if (fileCount < MAXFILE) {
|
||||
fileTable[fileCount].max = -1;
|
||||
|
||||
- sscanf(cptr, "%255s%c%d",
|
||||
+ memset(fileTable[fileCount].name, 0, sizeof(fileTable[0].name));
|
||||
+ items = sscanf(cptr, "%255s%c%d",
|
||||
fileTable[fileCount].name, &space, &fileTable[fileCount].max);
|
||||
/*
|
||||
* Log an error then return if the string scanned in was larger then
|
||||
* it should have been.
|
||||
*/
|
||||
- if (space != ' ') {
|
||||
+ if (items != 1 && space != ' ') {
|
||||
snmp_log(LOG_ERR, "file_parse_config: file name scanned " \
|
||||
"in from line %s is too large. fileCount = %d\n", cptr,
|
||||
fileCount);
|
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= net-snmp
|
||||
PORTVERSION= 5.1
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
|
||||
MASTER_SITE_SUBDIR= net-snmp
|
||||
|
24
net-mgmt/net-snmp/files/patch-file.c
Normal file
24
net-mgmt/net-snmp/files/patch-file.c
Normal file
@ -0,0 +1,24 @@
|
||||
--- agent/mibgroup/ucd-snmp/file.c.orig Thu Dec 25 23:57:14 2003
|
||||
+++ agent/mibgroup/ucd-snmp/file.c Thu Dec 25 23:57:37 2003
|
||||
@@ -91,17 +91,19 @@
|
||||
file_parse_config(const char *token, char *cptr)
|
||||
{
|
||||
char space;
|
||||
+ int items;
|
||||
|
||||
if (fileCount < MAXFILE) {
|
||||
fileTable[fileCount].max = -1;
|
||||
|
||||
- sscanf(cptr, "%255s%c%d",
|
||||
+ memset(fileTable[fileCount].name, 0, sizeof(fileTable[0].name));
|
||||
+ items = sscanf(cptr, "%255s%c%d",
|
||||
fileTable[fileCount].name, &space, &fileTable[fileCount].max);
|
||||
/*
|
||||
* Log an error then return if the string scanned in was larger then
|
||||
* it should have been.
|
||||
*/
|
||||
- if (space != ' ') {
|
||||
+ if (items != 1 && space != ' ') {
|
||||
snmp_log(LOG_ERR, "file_parse_config: file name scanned " \
|
||||
"in from line %s is too large. fileCount = %d\n", cptr,
|
||||
fileCount);
|
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= net-snmp
|
||||
PORTVERSION= 5.1
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
|
||||
MASTER_SITE_SUBDIR= net-snmp
|
||||
|
24
net-mgmt/net-snmp53/files/patch-file.c
Normal file
24
net-mgmt/net-snmp53/files/patch-file.c
Normal file
@ -0,0 +1,24 @@
|
||||
--- agent/mibgroup/ucd-snmp/file.c.orig Thu Dec 25 23:57:14 2003
|
||||
+++ agent/mibgroup/ucd-snmp/file.c Thu Dec 25 23:57:37 2003
|
||||
@@ -91,17 +91,19 @@
|
||||
file_parse_config(const char *token, char *cptr)
|
||||
{
|
||||
char space;
|
||||
+ int items;
|
||||
|
||||
if (fileCount < MAXFILE) {
|
||||
fileTable[fileCount].max = -1;
|
||||
|
||||
- sscanf(cptr, "%255s%c%d",
|
||||
+ memset(fileTable[fileCount].name, 0, sizeof(fileTable[0].name));
|
||||
+ items = sscanf(cptr, "%255s%c%d",
|
||||
fileTable[fileCount].name, &space, &fileTable[fileCount].max);
|
||||
/*
|
||||
* Log an error then return if the string scanned in was larger then
|
||||
* it should have been.
|
||||
*/
|
||||
- if (space != ' ') {
|
||||
+ if (items != 1 && space != ' ') {
|
||||
snmp_log(LOG_ERR, "file_parse_config: file name scanned " \
|
||||
"in from line %s is too large. fileCount = %d\n", cptr,
|
||||
fileCount);
|
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= net-snmp
|
||||
PORTVERSION= 5.1
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
|
||||
MASTER_SITE_SUBDIR= net-snmp
|
||||
|
24
net/net-snmp/files/patch-file.c
Normal file
24
net/net-snmp/files/patch-file.c
Normal file
@ -0,0 +1,24 @@
|
||||
--- agent/mibgroup/ucd-snmp/file.c.orig Thu Dec 25 23:57:14 2003
|
||||
+++ agent/mibgroup/ucd-snmp/file.c Thu Dec 25 23:57:37 2003
|
||||
@@ -91,17 +91,19 @@
|
||||
file_parse_config(const char *token, char *cptr)
|
||||
{
|
||||
char space;
|
||||
+ int items;
|
||||
|
||||
if (fileCount < MAXFILE) {
|
||||
fileTable[fileCount].max = -1;
|
||||
|
||||
- sscanf(cptr, "%255s%c%d",
|
||||
+ memset(fileTable[fileCount].name, 0, sizeof(fileTable[0].name));
|
||||
+ items = sscanf(cptr, "%255s%c%d",
|
||||
fileTable[fileCount].name, &space, &fileTable[fileCount].max);
|
||||
/*
|
||||
* Log an error then return if the string scanned in was larger then
|
||||
* it should have been.
|
||||
*/
|
||||
- if (space != ' ') {
|
||||
+ if (items != 1 && space != ' ') {
|
||||
snmp_log(LOG_ERR, "file_parse_config: file name scanned " \
|
||||
"in from line %s is too large. fileCount = %d\n", cptr,
|
||||
fileCount);
|
Loading…
Reference in New Issue
Block a user