ppp: Fix incorrect packet length for little-endian
authorZhenhua Zhang <zhenhua.zhang@intel.com>
Wed, 23 Jun 2010 09:46:37 +0000 (17:46 +0800)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 23 Jun 2010 21:45:28 +0000 (16:45 -0500)
packet->length is in TCP/IP network byte order. It needs to call ntohs()
to convert to host byte order, which is little-endian.

gatchat/ppp_ipcp.c

index a1eacdf..0b3c381 100644 (file)
@@ -281,7 +281,7 @@ static enum rcr_result ipcp_rcr(struct pppcp_data *pppcp,
                return RCR_ACCEPT;
 
        /* Reject all options */
-       *new_len = packet->length - sizeof(*packet);
+       *new_len = ntohs(packet->length) - sizeof(*packet);
        *new_options = g_memdup(packet->data, *new_len);
 
        return RCR_REJECT;