diff options
author | Denis Kenzior <denkenz@gmail.com> | 2011-06-29 05:00:56 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-06-29 05:00:56 -0500 |
commit | 2eb4611de8eb1fc874b59b757abfe90b30851d1f (patch) | |
tree | 71fefbfa04692ac8bd64573ae62256a844c1d61b /gatchat/ppp_auth.c | |
parent | e893deac59f35ea30a65f24217d565181b54c400 (diff) | |
download | ofono-2eb4611de8eb1fc874b59b757abfe90b30851d1f.tar.bz2 |
ppp: Add basic length sanity checks
Diffstat (limited to 'gatchat/ppp_auth.c')
-rw-r--r-- | gatchat/ppp_auth.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gatchat/ppp_auth.c b/gatchat/ppp_auth.c index 4ad31a2c..0f8cffab 100644 --- a/gatchat/ppp_auth.c +++ b/gatchat/ppp_auth.c @@ -118,9 +118,15 @@ challenge_out: /* * parse the packet */ -void ppp_chap_process_packet(struct ppp_chap *chap, const guint8 *new_packet) +void ppp_chap_process_packet(struct ppp_chap *chap, const guint8 *new_packet, + gsize len) { - guint8 code = new_packet[0]; + guint8 code; + + if (len < sizeof(struct chap_header)) + return; + + code = new_packet[0]; switch (code) { case CHALLENGE: |