From c2f9d7dee01589d1ec3619ff313abcdb95a0800f Mon Sep 17 00:00:00 2001 From: christiaans Date: Thu, 28 Sep 2006 11:43:49 +0000 Subject: [PATCH] Fixed encoding of object sub identifiers with trailing zero. --- src/core/snmp/asn1_enc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/snmp/asn1_enc.c b/src/core/snmp/asn1_enc.c index dc12f8a4..11aeea00 100644 --- a/src/core/snmp/asn1_enc.c +++ b/src/core/snmp/asn1_enc.c @@ -490,19 +490,20 @@ snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident) while (ident_len > 0) { s32_t sub_id; - u8_t shift; + u8_t shift, tail; ident_len--; sub_id = *ident; - + tail = 0; shift = 28; while(shift > 0) { u8_t code; code = sub_id >> shift; - if (code != 0) + if ((code != 0) || (tail != 0)) { + tail = 1; *msg_ptr = code | 0x80; ofs += 1; if (ofs >= plen)