From aafc0adfe1ee0ba6db554508dfa859856acacea0 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Thu, 26 Jul 2018 14:16:00 +0200 Subject: [PATCH] Fix bug #54381: SNMP RAW_DATA support is broken --- src/apps/snmp/snmp_msg.c | 2 +- src/include/lwip/apps/snmp_core.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/snmp/snmp_msg.c b/src/apps/snmp/snmp_msg.c index 562ec60e..0b6693a7 100644 --- a/src/apps/snmp/snmp_msg.c +++ b/src/apps/snmp/snmp_msg.c @@ -451,10 +451,10 @@ snmp_process_varbind(struct snmp_request *request, struct snmp_varbind *vb, u8_t } } else { s16_t len = node_instance.get_value(&node_instance, vb->value); - vb->type = node_instance.asn1_type; if (len >= 0) { vb->value_len = (u16_t)len; /* cast is OK because we checked >= 0 above */ + vb->type = node_instance.asn1_type; LWIP_ASSERT("SNMP_MAX_VALUE_SIZE is configured too low", (vb->value_len & ~SNMP_GET_VALUE_RAW_DATA) <= SNMP_MAX_VALUE_SIZE); err = snmp_append_outbound_varbind(&request->outbound_pbuf_stream, vb); diff --git a/src/include/lwip/apps/snmp_core.h b/src/include/lwip/apps/snmp_core.h index 9e7a518c..6021c722 100644 --- a/src/include/lwip/apps/snmp_core.h +++ b/src/include/lwip/apps/snmp_core.h @@ -191,7 +191,7 @@ typedef snmp_err_t (*node_instance_set_test_method)(struct snmp_node_instance*, typedef snmp_err_t (*node_instance_set_value_method)(struct snmp_node_instance*, u16_t, void*); typedef void (*node_instance_release_method)(struct snmp_node_instance*); -#define SNMP_GET_VALUE_RAW_DATA 0x8000 +#define SNMP_GET_VALUE_RAW_DATA 0x4000 /* do not use 0x8000 because return value of node_instance_get_value_method is signed16 and 0x8000 would be the signed bit */ /** SNMP node instance */ struct snmp_node_instance