X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppdump%2Fbsd-comp.c;h=966e958a1aa8bdd183ece8d384c3621b326026f0;hb=31db94f4f74809b687ef25e369b449b02964c6f8;hp=4ef5c7cb0b4a0c83dea740a3d84fa6a05f68deb9;hpb=1f32921b4018b34f7b05b2302f5946f58f48df61;p=ppp.git diff --git a/pppdump/bsd-comp.c b/pppdump/bsd-comp.c index 4ef5c7c..966e958 100644 --- a/pppdump/bsd-comp.c +++ b/pppdump/bsd-comp.c @@ -38,12 +38,14 @@ */ /* - * $Id: bsd-comp.c,v 1.2 1999/04/01 07:26:30 paulus Exp $ + * $Id: bsd-comp.c,v 1.4 2004/01/17 05:47:55 carlsonj Exp $ */ #include +#include #include #include +#include #include "ppp_defs.h" #include "ppp-comp.h" @@ -326,7 +328,7 @@ bsd_alloc(options, opt_len, decomp) db = (struct bsd_db *) malloc(newlen); if (!db) return NULL; - bzero(db, sizeof(*db) - sizeof(db->dict)); + memset(db, 0, sizeof(*db) - sizeof(db->dict)); if (!decomp) { db->lens = NULL; @@ -381,7 +383,7 @@ bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp) || options[0] != CI_BSD_COMPRESS || options[1] != CILEN_BSD_COMPRESS || BSD_VERSION(options[2]) != BSD_CURRENT_VERSION || BSD_NBITS(options[2]) != db->maxbits - || decomp && db->lens == NULL) + || (decomp && db->lens == NULL)) return 0; if (decomp) { @@ -554,11 +556,11 @@ bsd_decompress(state, cmsg, inlen, dmp, outlenp) u_int n_bits = db->n_bits; u_int tgtbitno = 32-n_bits; /* bitno when we have a code */ struct bsd_dict *dictp; - int explen, i, seq, len; + int explen, seq, len; u_int incode, oldcode, finchar; u_char *p, *rptr, *wptr; int ilen; - int dlen, space, codelen, extra; + int codelen, extra; rptr = cmsg; if (*rptr == 0) @@ -614,12 +616,12 @@ bsd_decompress(state, cmsg, inlen, dmp, outlenp) } if (incode > max_ent + 2 || incode > db->maxmaxcode - || incode > max_ent && oldcode == CLEAR) { + || (incode > max_ent && oldcode == CLEAR)) { if (db->debug) { printf("bsd_decomp%d: bad code 0x%x oldcode=0x%x ", db->unit, incode, oldcode); - printf("max_ent=0x%x dlen=%d seqno=%d\n", - max_ent, dlen, db->seqno); + printf("max_ent=0x%x seqno=%d\n", + max_ent, db->seqno); } return DECOMP_FATALERROR; /* probably a bug */ }