X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=unlzw.c;fp=unlzw.c;h=8f8cbeee16fa007762ae842d76e1ad1398c6066b;hb=a2016c1de6e4884f6c8ed5cc498f3bf821c25ca4;hp=5cf95b530f517c5ed256d3eaa71ef424bab30c4b;hpb=c7e61475680fa226bd9b8bdd469cd66914e630f5;p=debian%2Fgzip diff --git a/unlzw.c b/unlzw.c index 5cf95b5..8f8cbee 100644 --- a/unlzw.c +++ b/unlzw.c @@ -10,12 +10,8 @@ #include #include "tailor.h" -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif +#include +#include #include "gzip.h" #include "lzw.h" @@ -244,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];