Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/net Pull up revisions 1.11-1.17 (requested by fvdl):



details:   https://anonhg.NetBSD.org/src/rev/6376db6cc55a
branches:  netbsd-1-5
changeset: 492975:6376db6cc55a
user:      he <he%NetBSD.org@localhost>
date:      Wed Mar 20 23:18:36 2002 +0000

description:
Pull up revisions 1.11-1.17 (requested by fvdl):
  Upgrade libz to 1.1.4 due to a possible security bug.

diffstat:

 sys/net/zlib.c |  1590 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 1068 insertions(+), 522 deletions(-)

diffs (truncated from 3168 to 300 lines):

diff -r 362262a04ad4 -r 6376db6cc55a sys/net/zlib.c
--- a/sys/net/zlib.c    Wed Mar 20 23:18:32 2002 +0000
+++ b/sys/net/zlib.c    Wed Mar 20 23:18:36 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zlib.c,v 1.10 2000/03/30 09:45:41 augustss Exp $       */
+/*     $NetBSD: zlib.c,v 1.10.4.1 2002/03/20 23:18:36 he Exp $ */
 /*
  * This file is derived from various .h and .c files from the zlib-1.0.4
  * distribution by Jean-loup Gailly and Mark Adler, with some additions
@@ -11,16 +11,19 @@
  * - added inflateIncomp and deflateOutputPending
  * - allow strm->next_out to be NULL, meaning discard the output
  *
- * $Id: zlib.c,v 1.10 2000/03/30 09:45:41 augustss Exp $
+ * $Id: zlib.c,v 1.10.4.1 2002/03/20 23:18:36 he Exp $
  */
 
 /* 
- *  ==FILEVERSION 971210==
+ *  ==FILEVERSION 020312==
  *
  * This marker is used by the Linux installation script to determine
  * whether an up-to-date version of this file is already installed.
  */
 
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: zlib.c,v 1.10.4.1 2002/03/20 23:18:36 he Exp $");
+
 #define NO_DUMMY_DECL
 #define NO_ZCFUNCS
 #define MY_ZCALLOC
@@ -31,8 +34,9 @@
 
 
 /* +++ zutil.h */
+
 /* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-1996 Jean-loup Gailly.
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -41,7 +45,7 @@
    subject to change. Applications should only use zlib.h.
  */
 
-/* From: zutil.h,v 1.16 1996/07/24 13:41:13 me Exp $ */
+/* @(#) $Id: zlib.c,v 1.10.4.1 2002/03/20 23:18:36 he Exp $ */
 
 #ifndef _Z_UTIL_H
 #define _Z_UTIL_H
@@ -54,10 +58,6 @@
 #include <sys/time.h>
 #include <sys/systm.h>
 #  define HAVE_MEMCPY
-#  define memcpy(d, s, n)      bcopy((s), (d), (n))
-#  define memset(d, v, n)      bzero((d), (n))
-#  define memcmp               bcmp
-
 #else
 #if defined(__KERNEL__)
 /* Assume this is a Linux kernel */
@@ -66,19 +66,27 @@
 
 #else /* not kernel */
 
-#if defined(MSDOS)||defined(VMS)||defined(CRAY)||defined(WIN32)||defined(RISCOS)
-#   include <stddef.h>
-#   include <errno.h>
+#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE))
+
+/* XXX doesn't seem to need anything at all, but this is for consistency. */
+#  include <lib/libkern/libkern.h>
+
 #else
-    extern int errno;
-#endif
 #ifdef STDC
+#  include <stddef.h>
 #  include <string.h>
 #  include <stdlib.h>
 #endif
+#ifdef NO_ERRNO_H
+    extern int errno;
+#else
+#   include <errno.h>
+#endif
+#endif /* __NetBSD__ && _STANDALONE */
 #endif /* __KERNEL__ */
 #endif /* _KERNEL || KERNEL */
 
+
 #ifndef local
 #  define local static
 #endif
@@ -128,8 +136,14 @@
 
 #ifdef MSDOS
 #  define OS_CODE  0x00
-#  ifdef __TURBOC__
-#    include <alloc.h>
+#  if defined(__TURBOC__) || defined(__BORLANDC__)
+#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+       /* Allow compilation with ANSI keywords only enabled */
+       void _Cdecl farfree( void *block );
+       void *_Cdecl farmalloc( unsigned long nbytes );
+#    else
+#     include <alloc.h>
+#    endif
 #  else /* MSC or DJGPP */
 #    include <malloc.h>
 #  endif
@@ -145,7 +159,7 @@
 
 #if defined(VAXC) || defined(VMS)
 #  define OS_CODE  0x02
-#  define FOPEN(name, mode) \
+#  define F_OPEN(name, mode) \
      fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
 #endif
 
@@ -157,8 +171,15 @@
 #  define OS_CODE  0x05
 #endif
 
-#ifdef MACOS
+#if defined(MACOS) || defined(TARGET_OS_MAC)
 #  define OS_CODE  0x07
+#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+#    include <unix.h> /* for fdopen */
+#  else
+#    ifndef fdopen
+#      define fdopen(fd,mode) NULL /* No fdopen() */
+#    endif
+#  endif
 #endif
 
 #ifdef __50SERIES /* Prime/PRIMOS */
@@ -173,20 +194,25 @@
 #  define fdopen(fd,mode) NULL /* No fdopen() */
 #endif
 
+#if (defined(_MSC_VER) && (_MSC_VER > 600))
+#  define fdopen(fd,type)  _fdopen(fd,type)
+#endif
+
+
         /* Common defaults */
 
 #ifndef OS_CODE
 #  define OS_CODE  0x03  /* assume Unix */
 #endif
 
-#ifndef FOPEN
-#  define FOPEN(name, mode) fopen((name), (mode))
+#ifndef F_OPEN
+#  define F_OPEN(name, mode) fopen((name), (mode))
 #endif
 
          /* functions */
 
 #ifdef HAVE_STRERROR
-   extern char *strerror OF((int));
+   extern char *strerror __P((int));
 #  define zstrerror(errnum) strerror(errnum)
 #else
 #  define zstrerror(errnum) ""
@@ -195,9 +221,10 @@
 #if defined(pyr)
 #  define NO_MEMCPY
 #endif
-#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(_MSC_VER)
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
  /* Use our own functions for small and medium model with MSC <= 5.0.
   * You may have to use the same strategy for Borland C (untested).
+  * The __SC__ check is for Symantec.
   */
 #  define NO_MEMCPY
 #endif
@@ -215,24 +242,22 @@
 #    define zmemzero(dest, len) memset(dest, 0, len)
 #  endif
 #else
-   extern void zmemcpy  OF((Bytef* dest, Bytef* source, uInt len));
-   extern int  zmemcmp  OF((Bytef* s1,   Bytef* s2, uInt len));
-   extern void zmemzero OF((Bytef* dest, uInt len));
+   extern void zmemcpy  __P((Bytef* dest, const Bytef* source, uInt len));
+   extern int  zmemcmp  __P((const Bytef* s1, const Bytef* s2, uInt len));
+   extern void zmemzero __P((Bytef* dest, uInt len));
 #endif
 
 /* Diagnostic functions */
-#ifdef DEBUG_ZLIB
+#if defined(DEBUG_ZLIB) && !defined(_KERNEL) && !defined(_STANDALONE)
 #  include <stdio.h>
-#  ifndef verbose
-#    define verbose 0
-#  endif
-   extern void z_error    OF((char *m));
+   extern int z_verbose;
+   extern void z_error    __P((char *m));
 #  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
-#  define Trace(x) fprintf x
-#  define Tracev(x) {if (verbose) fprintf x ;}
-#  define Tracevv(x) {if (verbose>1) fprintf x ;}
-#  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
-#  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
+#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
+#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
+#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
 #else
 #  define Assert(cond,msg)
 #  define Trace(x)
@@ -243,10 +268,10 @@
 #endif
 
 
-typedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len));
-
-voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
-void   zcfree  OF((voidpf opaque, voidpf ptr));
+typedef uLong (ZEXPORT *check_func) __P((uLong check, const Bytef *buf,
+                                      uInt len));
+voidpf zcalloc __P((voidpf opaque, unsigned items, unsigned size));
+void   zcfree  __P((voidpf opaque, voidpf ptr));
 
 #define ZALLOC(strm, items, size) \
            (*((strm)->zalloc))((strm)->opaque, (items), (size))
@@ -257,8 +282,9 @@
 /* --- zutil.h */
 
 /* +++ deflate.h */
+
 /* deflate.h -- internal compression state
- * Copyright (C) 1995-1996 Jean-loup Gailly
+ * Copyright (C) 1995-2002 Jean-loup Gailly
  * For conditions of distribution and use, see copyright notice in zlib.h 
  */
 
@@ -267,7 +293,7 @@
    subject to change. Applications should only use zlib.h.
  */
 
-/* From: deflate.h,v 1.10 1996/07/02 12:41:00 me Exp $ */
+/* @(#) $Id: zlib.c,v 1.10.4.1 2002/03/20 23:18:36 he Exp $ */
 
 #ifndef _DEFLATE_H
 #define _DEFLATE_H
@@ -489,12 +515,12 @@
 
     ulg opt_len;        /* bit length of current block with optimal trees */
     ulg static_len;     /* bit length of current block with static trees */
-    ulg compressed_len; /* total bit length of compressed file */
     uInt matches;       /* number of string matches in current block */
     int last_eob_len;   /* bit length of EOB code for last block */
 
 #ifdef DEBUG_ZLIB
-    ulg bits_sent;      /* bit length of the compressed data */
+    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
 #endif
 
     ush bi_buf;
@@ -525,21 +551,63 @@
  */
 
         /* in trees.c */
-void _tr_init         OF((deflate_state *s));
-int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
-ulg  _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
+void _tr_init         __P((deflate_state *s));
+int  _tr_tally        __P((deflate_state *s, unsigned dist, unsigned lc));
+void _tr_flush_block  __P((deflate_state *s, charf *buf, ulg stored_len,
                          int eof));
-void _tr_align        OF((deflate_state *s));
-void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
+void _tr_align        __P((deflate_state *s));
+void _tr_stored_block __P((deflate_state *s, charf *buf, ulg stored_len,
                           int eof));
-void _tr_stored_type_only OF((deflate_state *));
+void _tr_stored_type_only __P((deflate_state *));
+
+#define d_code(dist) \
+   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * used.
+ */
+
+#ifndef DEBUG_ZLIB
+/* Inline versions of _tr_tally for speed: */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+  extern uch _length_code[];
+  extern uch _dist_code[];
+#else
+  extern const uch _length_code[];
+  extern const uch _dist_code[];



Home | Main Index | Thread Index | Old Index