From db95497bd3fa39663a38cf541cff23b781a82aba Mon Sep 17 00:00:00 2001 From: Jun Kuriyama Date: Thu, 25 Dec 2003 22:44:09 +0000 Subject: Fix parsing when "file " directive is used in snmpd.conf without maxfilesize column. --- net-mgmt/net-snmp-devel/files/patch-file.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 net-mgmt/net-snmp-devel/files/patch-file.c (limited to 'net-mgmt/net-snmp-devel/files/patch-file.c') diff --git a/net-mgmt/net-snmp-devel/files/patch-file.c b/net-mgmt/net-snmp-devel/files/patch-file.c new file mode 100644 index 000000000000..94eab370a857 --- /dev/null +++ b/net-mgmt/net-snmp-devel/files/patch-file.c @@ -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); -- cgit v1.2.3