aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-09-24 14:04:38 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-09-24 14:07:59 +0000
commit9b367343d7bfb944d55e3ff06d61c5977f660845 (patch)
tree0ed3b8efc4ee1eee814ac37736916cc3ddd0272e
parent6bdb184bee8ac9364997e653cb3a30759d5096a0 (diff)
downloadaports-9b367343d7bfb944d55e3ff06d61c5977f660845.tar.bz2
aports-9b367343d7bfb944d55e3ff06d61c5977f660845.tar.xz
main/net-snmp: fix CVE-2014-3565
fixes #3352
-rw-r--r--main/net-snmp/APKBUILD6
-rw-r--r--main/net-snmp/net-snmp-CVE-2014-3565.patch446
2 files changed, 451 insertions, 1 deletions
diff --git a/main/net-snmp/APKBUILD b/main/net-snmp/APKBUILD
index 6bcc8cefb3..96a5fcad5d 100644
--- a/main/net-snmp/APKBUILD
+++ b/main/net-snmp/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=net-snmp
pkgver=5.7.2.1
-pkgrel=0
+pkgrel=1
pkgdesc="Simple Network Management Protocol"
url="http://www.net-snmp.org/"
arch="all"
@@ -17,6 +17,7 @@ subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-agent-libs:alibs
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
netsnmp-swinst-crash.patch
fix-includes.patch
+ net-snmp-CVE-2014-3565.patch
snmpd.initd
snmpd.confd
snmptrapd.initd
@@ -156,6 +157,7 @@ tools() {
md5sums="7db683faba037249837b226f64d566d4 net-snmp-5.7.2.1.tar.gz
bd7dc10ffb5839e35ec37effcc53c2ad netsnmp-swinst-crash.patch
0fe11859a55f8e2489d5de629971a242 fix-includes.patch
+f43a7fef62333882a977acb9e211047c net-snmp-CVE-2014-3565.patch
3676e4d2e456e88da0dee8d7204749ba snmpd.initd
96510a2f3bc9f21648b03f7e8d76c0d3 snmpd.confd
7ce3e9e880fc6313ae87eb000bae4bda snmptrapd.initd
@@ -163,6 +165,7 @@ bd7dc10ffb5839e35ec37effcc53c2ad netsnmp-swinst-crash.patch
sha256sums="35dd20a2b17849f6d5a0a6109b4f52c1a777a3e1a00c79c4a175c520d23f3497 net-snmp-5.7.2.1.tar.gz
377e54bc2b66590c1c5174bf2e2c820adcbecd703d67c68be13c325d04d7d0c4 netsnmp-swinst-crash.patch
7528f7d368a0a4536915805c065f8496c37cb99dbc74d508bed89831cd5af37e fix-includes.patch
+a7fd0c8db7428e15c8ffbbb105d651fbcc81ef69b2f587ceb8a10f6d00afc6da net-snmp-CVE-2014-3565.patch
0f36683e3ab9855ab16c6a9e7f5934145b7f65a02c3dd46dc9627b721296119a snmpd.initd
4a8eb647d8b8f25b03858e3815489eaf2cd8fd4932185f97a1d896f8ee2f85e8 snmpd.confd
4baf3ee9950ded78078d93c32833ff657d7e85580d64778cdc9a963cf24bc7ab snmptrapd.initd
@@ -170,6 +173,7 @@ sha256sums="35dd20a2b17849f6d5a0a6109b4f52c1a777a3e1a00c79c4a175c520d23f3497 ne
sha512sums="6c4dadd145cab9572e2559ad99d6794469685086771c6d757d3667da1a061ab86746d53c28d48381c59a90d92b1812b813f3176cff156c41929177fb585299d0 net-snmp-5.7.2.1.tar.gz
78c036f1e6b4e3592cb2a6ff9b22671c930e337e9644298a9f78b6f13af1d9241d9c15dcc996b441b51cb2d551bf2dfe5caf602ff1e17baf7b6532f3dc6ba5bd netsnmp-swinst-crash.patch
87a552bd2e41684bba6e87fbcf6454a85ee912d7a339411fda24cebddf7661f0856729e076a917920a542cf84b687ffd90a091daa15f2c48f0ff64f3a53c0ddb fix-includes.patch
+8c831ea115413aa1170532865c72cbc9e6e3344b5739b1028095128d870689bcd1222a2fea6005760b80881212b0b92eba565e22fb03b037e1cb04d61378e2cc net-snmp-CVE-2014-3565.patch
887e84b775cd87a3631deac44aa35645c2df9b13b9346b2b23a80e513e82425304a79a8bf5234937f01638969788602539846e7fb8f9b5a9273c938a6233a175 snmpd.initd
3030ad11dd556569e481f108af69aef620b1fe67be8d8d12016f4aed1f0ffdb6c2ee87c40ed5bc883986568227e097cb7aa958658e01da51576848715bf65472 snmpd.confd
e9b29b89d27e88420932ea6ca077a6c807ae5555436cad4d840ec732b5851a498661d0d174f22d308f403904b623d7eadf9d201a539529ff57ced18bc8c58b6f snmptrapd.initd
diff --git a/main/net-snmp/net-snmp-CVE-2014-3565.patch b/main/net-snmp/net-snmp-CVE-2014-3565.patch
new file mode 100644
index 0000000000..86af4a03d9
--- /dev/null
+++ b/main/net-snmp/net-snmp-CVE-2014-3565.patch
@@ -0,0 +1,446 @@
+commit 7f4a7b891332899cea26e95be0337aae01648742
+Author: Jan Safranek <jsafranek@users.sourceforge.net>
+Date: Thu Jul 31 13:46:49 2014 +0200
+
+ Added checks for printing variables with wrong types.
+
+ When -OQ command line argument is used, variable formatter preffers the type
+ of the varible parsed from a MIB file instead of checking type of the variable
+ as parsed from SNMP message.
+
+ This can lead to crashes when incoming packets contains a variable with
+ NULL type, while the MIB says the variable should be non-NULL, like Integer.
+ The formatter then tries to interpret the NULL (from packet) as Integer (from
+ MIB file).
+
+diff --git a/snmplib/mib.c b/snmplib/mib.c
+index 9d3ca41..c6e0010 100644
+--- a/snmplib/mib.c
++++ b/snmplib/mib.c
+@@ -439,17 +439,16 @@ sprint_realloc_octet_string(u_char ** buf, size_t * buf_len,
+ u_char *cp;
+ int output_format, cnt;
+
+- if ((var->type != ASN_OCTET_STR) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- const char str[] = "Wrong Type (should be OCTET STRING): ";
+- if (snmp_cstrcat
+- (buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_OCTET_STR) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ const char str[] = "Wrong Type (should be OCTET STRING): ";
++ if (!snmp_cstrcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+
+@@ -702,16 +701,16 @@ sprint_realloc_float(u_char ** buf, size_t * buf_len,
+ const struct enum_list *enums,
+ const char *hint, const char *units)
+ {
+- if ((var->type != ASN_OPAQUE_FLOAT) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- if (snmp_cstrcat(buf, buf_len, out_len, allow_realloc,
+- "Wrong Type (should be Float): ")) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_OPAQUE_FLOAT) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be Float): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+@@ -772,17 +771,16 @@ sprint_realloc_double(u_char ** buf, size_t * buf_len,
+ const struct enum_list *enums,
+ const char *hint, const char *units)
+ {
+- if ((var->type != ASN_OPAQUE_DOUBLE) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- if (snmp_cstrcat
+- (buf, buf_len, out_len, allow_realloc,
+- "Wrong Type (should be Double): ")) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_OPAQUE_DOUBLE) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be Double): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+@@ -847,20 +845,21 @@ sprint_realloc_counter64(u_char ** buf, size_t * buf_len, size_t * out_len,
+ {
+ char a64buf[I64CHARSZ + 1];
+
+- if ((var->type != ASN_COUNTER64
++ if (var->type != ASN_COUNTER64
+ #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ && var->type != ASN_OPAQUE_COUNTER64
+ && var->type != ASN_OPAQUE_I64 && var->type != ASN_OPAQUE_U64
+ #endif
+- ) && (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- if (snmp_cstrcat(buf, buf_len, out_len, allow_realloc,
+- "Wrong Type (should be Counter64): ")) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ ) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be Counter64): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+@@ -948,23 +947,25 @@ sprint_realloc_opaque(u_char ** buf, size_t * buf_len,
+ const struct enum_list *enums,
+ const char *hint, const char *units)
+ {
+- if ((var->type != ASN_OPAQUE
++ if (var->type != ASN_OPAQUE
+ #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ && var->type != ASN_OPAQUE_COUNTER64
+ && var->type != ASN_OPAQUE_U64
+ && var->type != ASN_OPAQUE_I64
+ && var->type != ASN_OPAQUE_FLOAT && var->type != ASN_OPAQUE_DOUBLE
+ #endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
+- ) && (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- if (snmp_cstrcat(buf, buf_len, out_len, allow_realloc,
+- "Wrong Type (should be Opaque): ")) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ ) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be Opaque): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
++
+ #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ switch (var->type) {
+ case ASN_OPAQUE_COUNTER64:
+@@ -1040,17 +1041,16 @@ sprint_realloc_object_identifier(u_char ** buf, size_t * buf_len,
+ {
+ int buf_overflow = 0;
+
+- if ((var->type != ASN_OBJECT_ID) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] =
+- "Wrong Type (should be OBJECT IDENTIFIER): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_OBJECT_ID) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be OBJECT IDENTIFIER): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+@@ -1110,16 +1110,16 @@ sprint_realloc_timeticks(u_char ** buf, size_t * buf_len, size_t * out_len,
+ {
+ char timebuf[40];
+
+- if ((var->type != ASN_TIMETICKS) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] = "Wrong Type (should be Timeticks): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_TIMETICKS) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be Timeticks): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS)) {
+@@ -1277,17 +1277,18 @@ sprint_realloc_integer(u_char ** buf, size_t * buf_len, size_t * out_len,
+ {
+ char *enum_string = NULL;
+
+- if ((var->type != ASN_INTEGER) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] = "Wrong Type (should be INTEGER): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_INTEGER) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be INTEGER): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
++
+ for (; enums; enums = enums->next) {
+ if (enums->value == *var->val.integer) {
+ enum_string = enums->label;
+@@ -1380,16 +1381,16 @@ sprint_realloc_uinteger(u_char ** buf, size_t * buf_len, size_t * out_len,
+ {
+ char *enum_string = NULL;
+
+- if ((var->type != ASN_UINTEGER) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] = "Wrong Type (should be UInteger32): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_UINTEGER) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be UInteger32): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ for (; enums; enums = enums->next) {
+@@ -1477,17 +1478,16 @@ sprint_realloc_gauge(u_char ** buf, size_t * buf_len, size_t * out_len,
+ {
+ char tmp[32];
+
+- if ((var->type != ASN_GAUGE) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] =
+- "Wrong Type (should be Gauge32 or Unsigned32): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_GAUGE) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be Gauge32 or Unsigned32): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+@@ -1550,16 +1550,16 @@ sprint_realloc_counter(u_char ** buf, size_t * buf_len, size_t * out_len,
+ {
+ char tmp[32];
+
+- if ((var->type != ASN_COUNTER) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] = "Wrong Type (should be Counter32): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_COUNTER) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be Counter32): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+@@ -1613,16 +1613,16 @@ sprint_realloc_networkaddress(u_char ** buf, size_t * buf_len,
+ {
+ size_t i;
+
+- if ((var->type != ASN_IPADDRESS) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] = "Wrong Type (should be NetworkAddress): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_IPADDRESS) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be NetworkAddress): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+@@ -1679,16 +1679,16 @@ sprint_realloc_ipaddress(u_char ** buf, size_t * buf_len, size_t * out_len,
+ {
+ u_char *ip = var->val.string;
+
+- if ((var->type != ASN_IPADDRESS) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] = "Wrong Type (should be IpAddress): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_IPADDRESS) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be IpAddress): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+@@ -1737,20 +1737,20 @@ sprint_realloc_null(u_char ** buf, size_t * buf_len, size_t * out_len,
+ const struct enum_list *enums,
+ const char *hint, const char *units)
+ {
+- if ((var->type != ASN_NULL) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] = "Wrong Type (should be NULL): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_NULL) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be NULL): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+- } else {
+- u_char str[] = "NULL";
+- return snmp_strcat(buf, buf_len, out_len, allow_realloc, str);
+ }
++
++ u_char str[] = "NULL";
++ return snmp_strcat(buf, buf_len, out_len, allow_realloc, str);
+ }
+
+
+@@ -1785,16 +1785,16 @@ sprint_realloc_bitstring(u_char ** buf, size_t * buf_len, size_t * out_len,
+ u_char *cp;
+ char *enum_string;
+
+- if ((var->type != ASN_BIT_STR && var->type != ASN_OCTET_STR) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] = "Wrong Type (should be BITS): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_BIT_STR && var->type != ASN_OCTET_STR) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be BITS): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+@@ -1869,16 +1869,16 @@ sprint_realloc_nsapaddress(u_char ** buf, size_t * buf_len,
+ const struct enum_list *enums, const char *hint,
+ const char *units)
+ {
+- if ((var->type != ASN_NSAP) &&
+- (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+- u_char str[] = "Wrong Type (should be NsapAddress): ";
+- if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+- return sprint_realloc_by_type(buf, buf_len, out_len,
++ if (var->type != ASN_NSAP) {
++ if (!netsnmp_ds_get_boolean(
++ NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
++ u_char str[] = "Wrong Type (should be NsapAddress): ";
++ if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str))
++ return 0;
++ }
++ return sprint_realloc_by_type(buf, buf_len, out_len,
+ allow_realloc, var, NULL, NULL,
+ NULL);
+- } else {
+- return 0;
+- }
+ }
+
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {