From 2cb4b98869a3701ad591f2742dd7bb02ea6d1784 Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 28 Apr 2009 15:29:14 +0000 Subject: [PATCH] [packages] mini-snmpd: fix a segfault when passing an invalid oid to the -V option (closes: #5021), log messages to syslog git-svn-id: svn://svn.openwrt.org/openwrt/packages@15469 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- net/mini_snmpd/Makefile | 2 +- .../103-mib_encode_snmp_element_oid_fix.patch | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 net/mini_snmpd/patches/103-mib_encode_snmp_element_oid_fix.patch diff --git a/net/mini_snmpd/Makefile b/net/mini_snmpd/Makefile index 6433a1f0c..da0cb16a1 100644 --- a/net/mini_snmpd/Makefile +++ b/net/mini_snmpd/Makefile @@ -30,7 +30,7 @@ endef define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) \ CC="$(TARGET_CC)" \ - OFLAGS="$(TARGET_CFLAGS)" \ + OFLAGS="$(TARGET_CFLAGS) -DSYSLOG" \ STRIP="/bin/true" \ INSTALL_ROOT="$(PKG_INSTALL_DIR)" \ mini_snmpd install diff --git a/net/mini_snmpd/patches/103-mib_encode_snmp_element_oid_fix.patch b/net/mini_snmpd/patches/103-mib_encode_snmp_element_oid_fix.patch new file mode 100644 index 000000000..a46ace24e --- /dev/null +++ b/net/mini_snmpd/patches/103-mib_encode_snmp_element_oid_fix.patch @@ -0,0 +1,21 @@ +--- a/mib.c ++++ b/mib.c +@@ -120,6 +120,9 @@ static int encode_snmp_element_oid(value + int length; + int i; + ++ if (oid_value == NULL) { ++ return -1; ++ } + buffer = value->data.buffer; + length = 1; + for (i = 2; i < oid_value->subid_list_length; i++) { +@@ -293,6 +296,8 @@ static int mib_build_entry(const oid_t * + value->data.encoded_length = 0; + value->data.buffer = malloc(value->data.max_length); + if (encode_snmp_element_oid(value, oid_aton((const char *)default_value)) == -1) { ++ lprintf(LOG_ERR, "could not create MIB entry '%s.%d.%d': invalid oid '%s'\n", ++ oid_ntoa(prefix), column, row, (char *)default_value); + return -1; + } + break; -- 2.11.0