X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=common%2Fzlib.c;h=58c7939cafc3936fd5287084175b7f9b1ddd331a;hp=8ec7a9b992e80eaf031c9914108693f1fe227f40;hb=2ddcabd59d372be3f66c42ed9df15ca7a474ac2a;hpb=3419642e0abdbd98b9d7718a5cdd499683d673cf diff --git a/common/zlib.c b/common/zlib.c index 8ec7a9b..58c7939 100644 --- a/common/zlib.c +++ b/common/zlib.c @@ -10,7 +10,7 @@ * - added inflateIncomp and deflateOutputPending * - allow strm->next_out to be NULL, meaning discard the output * - * $Id: zlib.c,v 1.9 1998/02/04 01:36:09 paulus Exp $ + * $Id: zlib.c,v 1.12 2002/04/02 13:34:03 dfs Exp $ */ /* @@ -52,6 +52,7 @@ #include #include #include +#undef u # define HAVE_MEMCPY # define memcpy(d, s, n) bcopy((s), (d), (n)) # define memset(d, v, n) bzero((d), (n)) @@ -1147,12 +1148,12 @@ int deflateCopy (dest, source) return Z_STREAM_ERROR; ss = (deflate_state *) source->state; - *dest = *source; + zmemcpy(dest, source, sizeof(*dest)); ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); if (ds == Z_NULL) return Z_MEM_ERROR; dest->state = (struct internal_state FAR *) ds; - *ds = *ss; + zmemcpy(ds, ss, sizeof(*ds)); ds->strm = dest; ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); @@ -3860,10 +3861,11 @@ int r; &s->sub.trees.tb, z); if (t != Z_OK) { - ZFREE(z, s->sub.trees.blens); r = t; - if (r == Z_DATA_ERROR) + if (r == Z_DATA_ERROR) { s->mode = BADB; + ZFREE(z, s->sub.trees.blens); + } LEAVE } s->sub.trees.index = 0; @@ -3928,14 +3930,16 @@ int r; #endif t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), s->sub.trees.blens, &bl, &bd, &tl, &td, z); - ZFREE(z, s->sub.trees.blens); if (t != Z_OK) { - if (t == (uInt)Z_DATA_ERROR) + if (t == (uInt)Z_DATA_ERROR) { s->mode = BADB; + ZFREE(z, s->sub.trees.blens); + } r = t; LEAVE } + ZFREE(z, s->sub.trees.blens); Tracev((stderr, "inflate: trees ok, %d * %d bytes used\n", inflate_hufts, sizeof(inflate_huft))); if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)