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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gatchat/ppp_ipcp.c b/gatchat/ppp_ipcp.c
index a1eacdf..0b3c381 100644
--- a/gatchat/ppp_ipcp.c
+++ b/gatchat/ppp_ipcp.c
@@ -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;
-- 
1.6.3.3

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to