X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=unlzw.c;h=8f8cbeee16fa007762ae842d76e1ad1398c6066b;hb=acdbf0082754a9cbd2e7c0f689f09fb23b5c2bc4;hp=a330f98d4795f004f15c6e0c2723f3aa2c684f90;hpb=0d5a754ba8f2cc33e98d48d559f0ad6cd18a43a3;p=debian%2Fgzip diff --git a/unlzw.c b/unlzw.c index a330f98..8f8cbee 100644 --- a/unlzw.c +++ b/unlzw.c @@ -7,19 +7,11 @@ * to accommodate in-memory decompression. */ -#ifdef RCSID -static char rcsid[] = "$Id: unlzw.c,v 1.5 2006/12/11 18:54:39 eggert Exp $"; -#endif - #include #include "tailor.h" -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif +#include +#include #include "gzip.h" #include "lzw.h" @@ -248,7 +240,8 @@ int unlzw(in, out) int o; resetbuf: - e = insize-(o = (posbits>>3)); + o = posbits >> 3; + e = o <= insize ? insize - o : 0; for (i = 0 ; i < e ; ++i) { inbuf[i] = inbuf[i+o];