]> git.ozlabs.org Git - ppp.git/blobdiff - modules/deflate.c
build fix
[ppp.git] / modules / deflate.c
index f65273ca96713208a5b5f0fd37de2600faa8678c..f77f6eb657dfbca1a932961677f6357d853bcc18 100644 (file)
@@ -27,7 +27,7 @@
  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
  * OR MODIFICATIONS.
  *
- * $Id: deflate.c,v 1.8 1998/03/24 23:52:31 paulus Exp $
+ * $Id: deflate.c,v 1.10 2001/03/09 01:03:50 paulus Exp $
  */
 
 #ifdef AIX4
@@ -202,7 +202,11 @@ z_comp_alloc(options, opt_len)
        || options[3] != DEFLATE_CHK_SEQUENCE)
        return NULL;
     w_size = DEFLATE_SIZE(options[2]);
-    if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
+    /*
+     * N.B. the 9 below should be DEFLATE_MIN_SIZE (8), but using
+     * 8 will cause kernel crashes because of a bug in zlib.
+     */
+    if (w_size < 9 || w_size > DEFLATE_MAX_SIZE)
        return NULL;
 
 
@@ -454,7 +458,11 @@ z_decomp_alloc(options, opt_len)
        || options[3] != DEFLATE_CHK_SEQUENCE)
        return NULL;
     w_size = DEFLATE_SIZE(options[2]);
-    if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
+    /*
+     * N.B. the 9 below should be DEFLATE_MIN_SIZE (8), but using
+     * 8 will cause kernel crashes because of a bug in zlib.
+     */
+    if (w_size < 9 || w_size > DEFLATE_MAX_SIZE)
        return NULL;
 
 #ifdef __osf__
@@ -587,6 +595,7 @@ z_decompress(arg, mi, mop)
     mo->b_rptr += state->hdrlen;
     mo->b_wptr = wptr = mo->b_rptr;
     ospace = DECOMP_CHUNK;
+    olen = 0;
 
     /*
      * Fill in the first part of the PPP header.  The protocol field
@@ -609,7 +618,6 @@ z_decompress(arg, mi, mop)
     state->strm.next_out = wptr + 3;
     state->strm.avail_out = 1;
     decode_proto = 1;
-    olen = PPP_HDRLEN;
 
     /*
      * Call inflate, supplying more input or output as needed.
@@ -643,7 +651,6 @@ z_decompress(arg, mi, mop)
                    wptr[2] = wptr[3];
                    --state->strm.next_out;
                    ++state->strm.avail_out;
-                   --olen;
                }
                decode_proto = 0;
            } else {