X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppdump%2Fbsd-comp.c;h=966e958a1aa8bdd183ece8d384c3621b326026f0;hb=d00f8a0e184cc73b1ca33a9b22c1b1f87292a72f;hp=b08f2b781e4e86d672f7340d6f4168cf559bd955;hpb=f905a2633b5676a35078bcdcb392e66c943ead66;p=ppp.git diff --git a/pppdump/bsd-comp.c b/pppdump/bsd-comp.c index b08f2b7..966e958 100644 --- a/pppdump/bsd-comp.c +++ b/pppdump/bsd-comp.c @@ -38,11 +38,14 @@ */ /* - * $Id: bsd-comp.c,v 1.1 1999/03/23 03:21:57 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" @@ -325,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; @@ -380,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) { @@ -553,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) @@ -613,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 */ }