diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index be25ddd5d1c..d67aedaea05 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: auth.c,v 1.39 1999/02/18 00:52:12 brian Exp $ + * $Id: auth.c,v 1.40 1999/02/19 10:48:42 brian Exp $ * * TODO: * o Implement check against with registered IP addresses. @@ -327,11 +327,14 @@ auth_ReadHeader(struct authinfo *authp, struct mbuf *bp) bp = mbuf_Read(bp, (u_char *)&authp->in.hdr, sizeof authp->in.hdr); if (len >= ntohs(authp->in.hdr.length)) return bp; + authp->in.hdr.length = htons(0); log_Printf(LogWARN, "auth_ReadHeader: Short packet (%d > %d) !\n", ntohs(authp->in.hdr.length), len); - } else + } else { + authp->in.hdr.length = htons(0); log_Printf(LogWARN, "auth_ReadHeader: Short packet header (%d > %d) !\n", sizeof authp->in.hdr, len); + } mbuf_Free(bp); return NULL; diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c index 24127a921d3..fe76ebc216b 100644 --- a/usr.sbin/ppp/chap.c +++ b/usr.sbin/ppp/chap.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chap.c,v 1.45 1999/02/18 19:11:46 brian Exp $ + * $Id: chap.c,v 1.46 1999/02/18 19:45:06 brian Exp $ * * TODO: */ @@ -543,8 +543,9 @@ chap_Input(struct physical *p, struct mbuf *bp) int lanman; #endif - if ((bp = auth_ReadHeader(&chap->auth, bp)) == NULL) - log_Printf(LogERROR, "Chap Input: Truncated header !\n"); + if ((bp = auth_ReadHeader(&chap->auth, bp)) == NULL && + ntohs(chap->auth.in.hdr.length) == 0) + log_Printf(LogWARN, "Chap Input: Truncated header !\n"); else if (chap->auth.in.hdr.code == 0 || chap->auth.in.hdr.code > MAXCHAPCODE) log_Printf(LogPHASE, "Chap Input: %d: Bad CHAP code !\n", chap->auth.in.hdr.code); diff --git a/usr.sbin/ppp/pap.c b/usr.sbin/ppp/pap.c index 10be5776d5e..681f90dbe31 100644 --- a/usr.sbin/ppp/pap.c +++ b/usr.sbin/ppp/pap.c @@ -18,7 +18,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: pap.c,v 1.30 1999/02/02 09:35:17 brian Exp $ + * $Id: pap.c,v 1.31 1999/02/06 02:54:47 brian Exp $ * * TODO: */ @@ -155,8 +155,11 @@ pap_Input(struct physical *p, struct mbuf *bp) struct authinfo *authp = &p->dl->pap; u_char nlen, klen, *key; - if ((bp = auth_ReadHeader(authp, bp)) == NULL) + if ((bp = auth_ReadHeader(authp, bp)) == NULL && + ntohs(authp->in.hdr.length) == 0) { + log_Printf(LogWARN, "Pap Input: Truncated header !\n"); return; + } if (authp->in.hdr.code == 0 || authp->in.hdr.code > MAXPAPCODE) { log_Printf(LogPHASE, "Pap Input: %d: Bad PAP code !\n", authp->in.hdr.code);