summaryrefslogtreecommitdiffstats
path: root/gatchat/ppp_auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'gatchat/ppp_auth.c')
-rw-r--r--gatchat/ppp_auth.c10
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: