From f6f6f11838a51cf4af96fd2bb23f44fd5847644f Mon Sep 17 00:00:00 2001 From: christiaans Date: Fri, 13 Oct 2006 11:59:45 +0000 Subject: [PATCH] Fixed decoding of negative integers in snmp_asn1_dec_s32t(), removed EXPERIMENTAL status. --- src/core/snmp/asn1_dec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/snmp/asn1_dec.c b/src/core/snmp/asn1_dec.c index 11875f43..48833d63 100644 --- a/src/core/snmp/asn1_dec.c +++ b/src/core/snmp/asn1_dec.c @@ -1,6 +1,6 @@ /** * @file - * [EXPERIMENTAL] Abstract Syntax Notation One (ISO 8824, 8825) decoding + * Abstract Syntax Notation One (ISO 8824, 8825) decoding * * @todo not optimised (yet), favor correctness over speed, favor speed over size */ @@ -333,6 +333,7 @@ snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value) { u16_t plen, base; u8_t *msg_ptr; + u8_t *lsb_ptr = (u8_t*)value; u8_t sign; plen = 0; @@ -364,11 +365,11 @@ snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value) len--; if (sign) { - *value &= *msg_ptr; + *lsb_ptr &= *msg_ptr; } else { - *value |= *msg_ptr; + *lsb_ptr |= *msg_ptr; } *value <<= 8; ofs += 1; @@ -388,11 +389,11 @@ snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value) } if (sign) { - *value &= *msg_ptr; + *lsb_ptr &= *msg_ptr; } else { - *value |= *msg_ptr; + *lsb_ptr |= *msg_ptr; } return ERR_OK; }