lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #51520] Big endian bug in apps/snmp/snmp_asn1.c


From: Art Heers
Subject: [lwip-devel] [bug #51520] Big endian bug in apps/snmp/snmp_asn1.c
Date: Thu, 20 Jul 2017 17:32:59 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

URL:
  <http://savannah.nongnu.org/bugs/?51520>

                 Summary: Big endian bug in apps/snmp/snmp_asn1.c
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: artheers
            Submitted on: Thu 20 Jul 2017 09:32:57 PM UTC
                Category: apps
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.0.2

    _______________________________________________________

Details:


In this function:
err_t
snmp_asn1_dec_s32t(struct snmp_pbuf_stream *pbuf_stream, u16_t len, s32_t
*value)


this code is wrong for BIG_ENDIAN machines:

#if BYTE_ORDER == LITTLE_ENDIAN
      *value <<= 8;
#endif
#if BYTE_ORDER == BIG_ENDIAN
      *value >>= 8;
#endif


For both little and big endian, it should be *value <<= 8;

For big endian machines, *value always ends up with only the least significant
byte.






    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?51520>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]