+++ /dev/null
-diff -urN mod_gzip-1.3.26.1a.org/mod_gzip.c mod_gzip-1.3.26.1a/mod_gzip.c
---- mod_gzip-1.3.26.1a.org/mod_gzip.c Fri Apr 25 11:52:24 2003
-+++ mod_gzip-1.3.26.1a/mod_gzip.c Fri Apr 25 15:33:54 2003
-@@ -7508,7 +7508,7 @@
- mod_gzip_printf( "%s: Call gzp_main(r,gzp)...",cn);
- #endif
-
-- rc = gzp_main( r, gzp );
-+ rc = mod_gzip_gzp_main( r, gzp );
-
- output_size = (long) gzp->bytes_out;
-
-@@ -8100,7 +8100,7 @@
- mod_gzip_strcpy(gzc.input_filename, r->filename);
- mod_gzip_strcpy(gzc.output_filename,dest);
-
-- rc = gzp_main(r,&gzc);
-+ rc = mod_gzip_gzp_main(r,&gzc);
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
- if(gzc.bytes_out > 0) {
-diff -urN mod_gzip-1.3.26.1a.org/mod_gzip.h mod_gzip-1.3.26.1a/mod_gzip.h
---- mod_gzip-1.3.26.1a.org/mod_gzip.h Fri Apr 25 11:52:24 2003
-+++ mod_gzip-1.3.26.1a/mod_gzip.h Fri Apr 25 15:32:16 2003
-@@ -354,7 +354,7 @@
-
- } GZP_CONTROL;
-
--int gzp_main(request_rec *, GZP_CONTROL *);
-+int mod_gzip_gzp_main(request_rec *, GZP_CONTROL *);
- char *mod_gzip_generate_vary_header(mod_gzip_conf *,struct pool *);
- int mod_gzip_compress_file(request_rec *,char *);
-
-diff -urN mod_gzip-1.3.26.1a.org/mod_gzip_compress.c mod_gzip-1.3.26.1a/mod_gzip_compress.c
---- mod_gzip-1.3.26.1a.org/mod_gzip_compress.c Fri Apr 25 11:52:24 2003
-+++ mod_gzip-1.3.26.1a/mod_gzip_compress.c Fri Apr 25 15:31:52 2003
-@@ -678,7 +678,7 @@
- ush max_chain;
- } config;
-
--config configuration_table[10] = {
-+static config configuration_table[10] = {
-
- {0, 0, 0, 0},
- {4, 4, 8, 4},
-@@ -723,19 +723,19 @@
- } v;
- };
-
--uch bl_order[BL_CODES]
-+static uch bl_order[BL_CODES]
- = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
-
--int extra_lbits[LENGTH_CODES]
-+static int extra_lbits[LENGTH_CODES]
- = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
-
--int extra_dbits[D_CODES]
-+static int extra_dbits[D_CODES]
- = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
-
--int extra_blbits[BL_CODES]
-+static int extra_blbits[BL_CODES]
- = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
-
--ulg crc_32_tab[] = {
-+static ulg crc_32_tab[] = {
- 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
- 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
- 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
-@@ -941,7 +941,7 @@
-
- } GZ1;
- typedef GZ1 *PGZ1;
--int gz1_size = sizeof( GZ1 );
-+static int gz1_size = sizeof( GZ1 );
-
- /* Declare some local function protypes... */
-
-@@ -952,118 +952,118 @@
- /* if the code is being compiled directly into the parent */
- /* instead of being built as a standalone DLL or DSO library. */
-
--PGZ1 gz1_init ( void );
--int gz1_cleanup ( PGZ1 gz1 );
--ulg gz1_deflate ( PGZ1 gz1 );
--ulg gz1_deflate_fast( PGZ1 gz1 );
-+static PGZ1 gz1_init ( void );
-+static int gz1_cleanup ( PGZ1 gz1 );
-+static ulg gz1_deflate ( PGZ1 gz1 );
-+static ulg gz1_deflate_fast( PGZ1 gz1 );
-
- /* The rest of the routines should not need the 'gz1_' prefix. */
- /* No conflicts reported at this time. */
-
--int inflate ( PGZ1 gz1 );
--int inflate_dynamic( PGZ1 gz1 );
--int inflate_stored ( PGZ1 gz1 );
--int inflate_fixed ( PGZ1 gz1 );
--void fill_window ( PGZ1 gz1 );
--void flush_outbuf ( PGZ1 gz1 );
--void flush_window ( PGZ1 gz1 );
--void bi_windup ( PGZ1 gz1 );
--void set_file_type ( PGZ1 gz1 );
--void init_block ( PGZ1 gz1 );
--int build_bl_tree ( PGZ1 gz1 );
--void read_error ( PGZ1 gz1 );
--void write_error ( PGZ1 gz1 );
--int get_header ( PGZ1 gz1, int in );
--int inflate_block ( PGZ1 gz1, int *e );
--int fill_inbuf ( PGZ1 gz1, int eof_ok );
--char *gz1_basename ( PGZ1 gz1, char *fname );
--int longest_match ( PGZ1 gz1, unsigned cur_match );
--void bi_init ( PGZ1 gz1, gz1_file_t zipfile );
--int file_read ( PGZ1 gz1, char *buf, unsigned size );
--void write_buf ( PGZ1 gz1, int fd, voidp buf, unsigned cnt );
-+static int inflate ( PGZ1 gz1 );
-+static int inflate_dynamic( PGZ1 gz1 );
-+static int inflate_stored ( PGZ1 gz1 );
-+static int inflate_fixed ( PGZ1 gz1 );
-+static void fill_window ( PGZ1 gz1 );
-+static void flush_outbuf ( PGZ1 gz1 );
-+static void flush_window ( PGZ1 gz1 );
-+static void bi_windup ( PGZ1 gz1 );
-+static void set_file_type ( PGZ1 gz1 );
-+static void init_block ( PGZ1 gz1 );
-+static int build_bl_tree ( PGZ1 gz1 );
-+static void read_error ( PGZ1 gz1 );
-+static void write_error ( PGZ1 gz1 );
-+static int get_header ( PGZ1 gz1, int in );
-+static int inflate_block ( PGZ1 gz1, int *e );
-+static int fill_inbuf ( PGZ1 gz1, int eof_ok );
-+static char *gz1_basename ( PGZ1 gz1, char *fname );
-+static int longest_match ( PGZ1 gz1, unsigned cur_match );
-+static void bi_init ( PGZ1 gz1, gz1_file_t zipfile );
-+static int file_read ( PGZ1 gz1, char *buf, unsigned size );
-+static void write_buf ( PGZ1 gz1, int fd, voidp buf, unsigned cnt );
-
--void error( char *msg );
-+static void error( char *msg );
-
--int zip(
-+static int zip(
- PGZ1 gz1,
- int in,
- int out
- );
-
--ulg flush_block(
-+static ulg flush_block(
- PGZ1 gz1,
- char *buf,
- ulg stored_len,
- int eof
- );
-
--void copy_block(
-+static void copy_block(
- PGZ1 gz1,
- char *buf,
- unsigned len,
- int header
- );
-
--int ct_tally(
-+static int ct_tally(
- PGZ1 gz1,
- int dist,
- int lc
- );
-
--void send_bits(
-+static void send_bits(
- PGZ1 gz1,
- int value,
- int length
- );
-
--void send_tree(
-+static void send_tree(
- PGZ1 gz1,
- ct_data *tree,
- int max_code
- );
-
--void send_all_trees(
-+static void send_all_trees(
- PGZ1 gz1,
- int lcodes,
- int dcodes,
- int blcodes
- );
-
--void mod_gzip_ct_init(
-+static void mod_gzip_ct_init(
- PGZ1 gz1,
- ush *attr,
- int *methodp
- );
-
--void lm_init(
-+static void lm_init(
- PGZ1 gz1,
- int pack_level,
- ush *flags
- );
-
--void build_tree(
-+static void build_tree(
- PGZ1 gz1,
- tree_desc *desc
- );
-
--void compress_block(
-+static void compress_block(
- PGZ1 gz1,
- ct_data *ltree,
- ct_data *dtree
- );
-
--void gen_bitlen(
-+static void gen_bitlen(
- PGZ1 gz1,
- tree_desc *desc
- );
-
--void pqdownheap(
-+static void pqdownheap(
- PGZ1 gz1,
- ct_data *tree,
- int k
- );
-
--int huft_build(
-+static int huft_build(
- PGZ1 gz1,
- unsigned *b,
- unsigned n,
-@@ -1074,13 +1074,13 @@
- int *m
- );
-
--ulg updcrc(
-+static ulg updcrc(
- PGZ1 gz1,
- uch *s,
- unsigned n
- );
-
--int inflate_codes(
-+static int inflate_codes(
- PGZ1 gz1,
- struct huft *tl,
- struct huft *td,
-@@ -1088,30 +1088,30 @@
- int bd
- );
-
--void gen_codes(
-+static void gen_codes(
- PGZ1 gz1,
- ct_data *tree,
- int max_code
- );
-
--void scan_tree(
-+static void scan_tree(
- PGZ1 gz1,
- ct_data *tree,
- int max_code
- );
-
--unsigned bi_reverse(
-+static unsigned bi_reverse(
- PGZ1 gz1,
- unsigned code,
- int len
- );
-
--int huft_free(
-+static int huft_free(
- PGZ1 gz1,
- struct huft *t
- );
-
--PGZ1 gz1_init()
-+static PGZ1 gz1_init()
- {
- PGZ1 gz1=0;
-
-@@ -1232,7 +1232,7 @@
-
- }
-
--int gz1_cleanup( PGZ1 gz1 )
-+static int gz1_cleanup( PGZ1 gz1 )
- {
-
- #ifndef MAXSEG_64K
-@@ -1254,20 +1254,20 @@
- return 0;
- }
-
--int (*read_buf)(PGZ1 gz1, char *buf, unsigned size);
-+static int (*read_buf)(PGZ1 gz1, char *buf, unsigned size);
-
--void error( char *msg )
-+static void error( char *msg )
- {
- msg = msg;
- }
-
--int (*work)( PGZ1 gz1, int infile, int outfile ) = 0;
-+static int (*work)( PGZ1 gz1, int infile, int outfile ) = 0;
-
- #ifdef __BORLANDC__
- #pragma argsused
- #endif
-
--int get_header( PGZ1 gz1, int in )
-+static int get_header( PGZ1 gz1, int in )
- {
- uch flags;
- char magic[2];
-@@ -1365,7 +1365,7 @@
- return gz1->method;
- }
-
--int fill_inbuf( PGZ1 gz1, int eof_ok )
-+static int fill_inbuf( PGZ1 gz1, int eof_ok )
- {
- int len;
- int bytes_to_copy;
-@@ -1429,7 +1429,7 @@
- return gz1->inbuf[0];
- }
-
--ulg updcrc(
-+static ulg updcrc(
- PGZ1 gz1,
- uch *s,
- unsigned n
-@@ -1459,12 +1459,12 @@
- return( c ^ 0xffffffffL );
- }
-
--void read_error( PGZ1 gz1 )
-+static void read_error( PGZ1 gz1 )
- {
- gz1->abortflag = 1;
- }
-
--void mod_gzip_strlwr( char *s )
-+static void mod_gzip_strlwr( char *s )
- {
- char *p1=s;
-
-@@ -1481,7 +1481,7 @@
- #pragma argsused
- #endif
-
--char *gz1_basename( PGZ1 gz1, char *fname )
-+static char *gz1_basename( PGZ1 gz1, char *fname )
- {
- char *p;
- if ((p = strrchr(fname, PATH_SEP)) != NULL) fname = p+1;
-@@ -1498,7 +1498,7 @@
- return fname;
- }
-
--void write_buf( PGZ1 gz1, int fd, voidp buf, unsigned cnt )
-+static void write_buf( PGZ1 gz1, int fd, voidp buf, unsigned cnt )
- {
- unsigned n;
-
-@@ -1528,7 +1528,7 @@
- }
- }
-
--void write_error( PGZ1 gz1 )
-+static void write_error( PGZ1 gz1 )
- {
- gz1->abortflag = 1;
- }
-@@ -1538,7 +1538,7 @@
-
- static ush ptr_offset = 0;
-
--void * fcalloc(
-+static void * fcalloc(
- unsigned items,
- unsigned size
- )
-@@ -1562,7 +1562,7 @@
- return buf;
- }
-
--void fcfree( void *ptr )
-+static void fcfree( void *ptr )
- {
- *((ush*)&ptr+1) -= (ptr_offset + 15) >> 4;
- *(ush*)&ptr = ptr_offset;
-@@ -1573,7 +1573,7 @@
- #endif
- #endif
-
--int zip(
-+static int zip(
- PGZ1 gz1,
- int in,
- int out
-@@ -1637,7 +1637,7 @@
- return OK;
- }
-
--ulg gz1_deflate( PGZ1 gz1 )
-+static ulg gz1_deflate( PGZ1 gz1 )
- {
- unsigned hash_head;
- unsigned prev_match;
-@@ -1724,7 +1724,7 @@
- return 0;
- }
-
--void flush_outbuf( PGZ1 gz1 )
-+static void flush_outbuf( PGZ1 gz1 )
- {
- if ( gz1->outcnt == 0 )
- {
-@@ -1737,7 +1737,7 @@
- gz1->outcnt = 0;
- }
-
--void lm_init(
-+static void lm_init(
- PGZ1 gz1,
- int pack_level,
- ush *flags
-@@ -1805,7 +1805,7 @@
- }
- }
-
--void fill_window( PGZ1 gz1 )
-+static void fill_window( PGZ1 gz1 )
- {
- register unsigned n, m;
-
-@@ -1856,7 +1856,7 @@
- }
- }
-
--ulg gz1_deflate_fast( PGZ1 gz1 )
-+static ulg gz1_deflate_fast( PGZ1 gz1 )
- {
- unsigned hash_head;
- int flush;
-@@ -1927,7 +1927,7 @@
- return FLUSH_BLOCK(1);
- }
-
--void mod_gzip_ct_init(
-+static void mod_gzip_ct_init(
- PGZ1 gz1,
- ush *attr,
- int *methodp
-@@ -2013,7 +2013,7 @@
- init_block( gz1 );
- }
-
--ulg flush_block(
-+static ulg flush_block(
- PGZ1 gz1,
- char *buf,
- ulg stored_len,
-@@ -2117,7 +2117,7 @@
- #pragma argsused
- #endif
-
--unsigned bi_reverse(
-+static unsigned bi_reverse(
- PGZ1 gz1,
- unsigned code,
- int len
-@@ -2134,7 +2134,7 @@
- return res >> 1;
- }
-
--void set_file_type( PGZ1 gz1 )
-+static void set_file_type( PGZ1 gz1 )
- {
- int n = 0;
- unsigned ascii_freq = 0;
-@@ -2147,7 +2147,7 @@
- *gz1->file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
- }
-
--void init_block( PGZ1 gz1 )
-+static void init_block( PGZ1 gz1 )
- {
- int n;
-
-@@ -2166,7 +2166,7 @@
- gz1->flag_bit = 1;
- }
-
--void bi_init( PGZ1 gz1, gz1_file_t zipfile )
-+static void bi_init( PGZ1 gz1, gz1_file_t zipfile )
- {
- gz1->zfile = zipfile;
- gz1->bi_buf = 0;
-@@ -2178,7 +2178,7 @@
- }
- }
-
--int ct_tally(
-+static int ct_tally(
- PGZ1 gz1,
- int dist,
- int lc
-@@ -2231,7 +2231,7 @@
- return( gz1->last_lit == LIT_BUFSIZE-1 || gz1->last_dist == DIST_BUFSIZE );
- }
-
--void compress_block(
-+static void compress_block(
- PGZ1 gz1,
- ct_data *ltree,
- ct_data *dtree
-@@ -2279,7 +2279,7 @@
-
- #ifndef ASMV
-
--int longest_match( PGZ1 gz1, unsigned cur_match )
-+static int longest_match( PGZ1 gz1, unsigned cur_match )
- {
- unsigned chain_length = gz1->max_chain_length;
- register uch *scan = gz1->window + gz1->strstart;
-@@ -2363,7 +2363,7 @@
- }
- #endif
-
--void send_bits(
-+static void send_bits(
- PGZ1 gz1,
- int value,
- int length
-@@ -2385,7 +2385,7 @@
- }
- }
-
--void build_tree(
-+static void build_tree(
- PGZ1 gz1,
- tree_desc *desc
- )
-@@ -2443,7 +2443,7 @@
- gen_codes(gz1,(ct_data *)tree, max_code);
- }
-
--int build_bl_tree( PGZ1 gz1 )
-+static int build_bl_tree( PGZ1 gz1 )
- {
- int max_blindex;
-
-@@ -2462,7 +2462,7 @@
- return max_blindex;
- }
-
--void gen_codes(
-+static void gen_codes(
- PGZ1 gz1,
- ct_data *tree,
- int max_code
-@@ -2489,7 +2489,7 @@
- return;
- }
-
--void gen_bitlen(
-+static void gen_bitlen(
- PGZ1 gz1,
- tree_desc *desc
- )
-@@ -2552,7 +2552,7 @@
- }
- }
-
--void copy_block(
-+static void copy_block(
- PGZ1 gz1,
- char *buf,
- unsigned len,
-@@ -2581,7 +2581,7 @@
- }
- }
-
--int file_read( PGZ1 gz1, char *buf, unsigned size )
-+static int file_read( PGZ1 gz1, char *buf, unsigned size )
- {
- unsigned len = 0;
- unsigned bytes_to_copy = 0;
-@@ -2626,7 +2626,7 @@
- return (int)len;
- }
-
--void bi_windup( PGZ1 gz1 )
-+static void bi_windup( PGZ1 gz1 )
- {
- if ( gz1->bi_valid > 8 )
- {
-@@ -2641,7 +2641,7 @@
- gz1->bi_valid = 0;
- }
-
--void send_all_trees(
-+static void send_all_trees(
- PGZ1 gz1,
- int lcodes,
- int dcodes,
-@@ -2663,7 +2663,7 @@
- send_tree(gz1,(ct_data *)gz1->dyn_dtree, dcodes-1);
- }
-
--void send_tree(
-+static void send_tree(
- PGZ1 gz1,
- ct_data *tree,
- int max_code
-@@ -2728,7 +2728,7 @@
- }
- }
-
--void scan_tree(
-+static void scan_tree(
- PGZ1 gz1,
- ct_data *tree,
- int max_code
-@@ -2794,7 +2794,7 @@
- }
- }
-
--void pqdownheap(
-+static void pqdownheap(
- PGZ1 gz1,
- ct_data *tree,
- int k
-@@ -2822,15 +2822,15 @@
- #define GZS_DEFLATE1 3
- #define GZS_DEFLATE2 4
-
--int gzs_fsp ( PGZ1 gz1 );
--int gzs_zip1 ( PGZ1 gz1 );
--int gzs_zip2 ( PGZ1 gz1 );
--int gzs_deflate1( PGZ1 gz1 );
--int gzs_deflate2( PGZ1 gz1 );
-+static int gzs_fsp ( PGZ1 gz1 );
-+static int gzs_zip1 ( PGZ1 gz1 );
-+static int gzs_zip2 ( PGZ1 gz1 );
-+static int gzs_deflate1( PGZ1 gz1 );
-+static int gzs_deflate2( PGZ1 gz1 );
-
--int gzp_main( request_rec *r, GZP_CONTROL *gzp )
-+int mod_gzip_gzp_main( request_rec *r, GZP_CONTROL *gzp )
- {
-- char cn[]="gzp_main()";
-+ char cn[]="mod_gzip_gzp_main()";
-
- PGZ1 gz1 = 0;
- int rc = 0;
-@@ -2996,7 +2996,7 @@
- return final_exit_code;
- }
-
--int gzs_fsp( PGZ1 gz1 )
-+static int gzs_fsp( PGZ1 gz1 )
- {
- int rc=0;
-
-@@ -3036,7 +3036,7 @@
- return( rc );
- }
-
--int gzs_zip1( PGZ1 gz1 )
-+static int gzs_zip1( PGZ1 gz1 )
- {
- uch flags = 0;
-
-@@ -3070,7 +3070,7 @@
- return 0;
- }
-
--int gzs_zip2( PGZ1 gz1 )
-+static int gzs_zip2( PGZ1 gz1 )
- {
- #ifdef FUTURE_USE
- uch flags = 0;
-@@ -3103,7 +3103,7 @@
- return 0;
- }
-
--int gzs_deflate1( PGZ1 gz1 )
-+static int gzs_deflate1( PGZ1 gz1 )
- {
- if ( !gz1->deflate1_initialized )
- {
-@@ -3219,7 +3219,7 @@
- return 0;
- }
-
--int gzs_deflate2( PGZ1 gz1 )
-+static int gzs_deflate2( PGZ1 gz1 )
- {
- #if !defined(NO_SIZE_CHECK) && !defined(RECORD_IO)
- if (gz1->ifile_size != -1L && gz1->isize != (ulg)gz1->ifile_size)
+++ /dev/null
-fixes CAN-2003-0842, CAN-2003-0843, CAN-2003-0844
-taken from SuSE apache-contrib package updates
-
-diff -purEbB mod_gzip-1.3.26.1a/mod_gzip.c mod_gzip-1.3.26.1a.fix/mod_gzip.c
---- mod_gzip-1.3.26.1a/mod_gzip.c 2002-10-01 09:29:49.000000000 +0200
-+++ mod_gzip-1.3.26.1a.fix/mod_gzip.c 2004-01-13 17:16:05.000000000 +0100
-@@ -93,6 +93,10 @@
-
- #define CORE_PRIVATE
-
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <fcntl.h>
-+
- #include "httpd.h"
- #include "http_config.h"
- #include "http_core.h"
-@@ -1382,8 +1386,8 @@ int targetmaxlen
- slash[1]=0;
- }
-
-- sprintf(
-- target,
-+ snprintf(
-+ target, targetmaxlen,
- "%s%s_%ld_%ld_%ld.wrk",
- prefix,
- slash,
-@@ -1394,8 +1398,8 @@ int targetmaxlen
- }
- else
- {
-- sprintf(
-- target,
-+ snprintf(
-+ target, targetmaxlen,
- "_%ld_%ld_%ld.wrk",
- (long) process_id,
- (long) thread_id,
-@@ -3631,7 +3635,7 @@ mod_gzip_set_temp_dir( cmd_parms *parms,
- if ( ( *(mgc->temp_dir+(arglen-1)) != '\\' ) &&
- ( *(mgc->temp_dir+(arglen-1)) != '/' ) )
- {
-- mod_gzip_strcat( mgc->temp_dir, dirsep );
-+ strcat( mgc->temp_dir, dirsep );
- }
-
- rc = stat( mgc->temp_dir, &sbuf );
-@@ -3734,7 +3738,8 @@ static const char *mod_gzip_static_suffi
- return "mod_gzip_static_suffix: suffix to long!";
- }
-
-- mod_gzip_strcpy(mgc->suffix,arg1);
-+ strncpy(mgc->suffix,arg1,sizeof(mgc->suffix)-1);
-+ mgc->suffix[sizeof(mgc->suffix)-1] = '\0';
- mgc->suffix_set = 1;
- return NULL;
- }
-@@ -5221,8 +5226,9 @@ mod_gzip_conf *dconf,
- char *input_filename
- )
- {
-- FILE *ifh=0;
-- FILE *ofh=0;
-+ FILE *ifh=NULL;
-+ FILE *ofh=NULL;
-+ int ofd=-1;
- int ofh_used=0;
-
- int i=0;
-@@ -5763,7 +5769,7 @@ char *input_filename
- send_as_is++;
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-- mod_gzip_strcat( lbuf, ":NO_200");
-+ strcat( lbuf, ":NO_200");
- #endif
- }
-
-@@ -5778,7 +5784,7 @@ char *input_filename
- send_as_is++;
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-- mod_gzip_strcat( lbuf, ":RESPONSE_FIELD_EXCLUDED");
-+ strcat( lbuf, ":RESPONSE_FIELD_EXCLUDED");
- #endif
- }
-
-@@ -5793,7 +5799,7 @@ char *input_filename
- send_as_is++;
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-- mod_gzip_strcat( lbuf, ":NO_BODY");
-+ strcat( lbuf, ":NO_BODY");
- #endif
- }
-
-@@ -5807,7 +5813,7 @@ char *input_filename
- send_as_is++;
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-- mod_gzip_strcat( lbuf, ":UNKNOWN_TE_VALUE");
-+ strcat( lbuf, ":UNKNOWN_TE_VALUE");
- #endif
- }
-
-@@ -5821,7 +5827,7 @@ char *input_filename
- send_as_is++;
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-- mod_gzip_strcat( lbuf, ":HAS_CE");
-+ strcat( lbuf, ":HAS_CE");
- #endif
- }
-
-@@ -5835,7 +5841,7 @@ char *input_filename
- send_as_is++;
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-- mod_gzip_strcat( lbuf, ":NO_CONTENT_TYPE_IN_RESPONSE_HEADER");
-+ strcat( lbuf, ":NO_CONTENT_TYPE_IN_RESPONSE_HEADER");
- #endif
- }
- else if ( !send_as_is )
-@@ -5891,7 +5897,7 @@ char *input_filename
- send_as_is++;
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-- mod_gzip_strcat( lbuf, ":RESPONSE_CONTENT_TYPE_EXCLUDED");
-+ strcat( lbuf, ":RESPONSE_CONTENT_TYPE_EXCLUDED");
- #endif
- }
- }
-@@ -6041,7 +6047,11 @@ char *input_filename
- mod_gzip_printf( "%s: Call OUTPUT fopen(%s)...",cn,npp(output_filename1));
- #endif
-
-- ofh = fopen( output_filename1, "wb" );
-+ if( (ofd = open(output_filename1, O_WRONLY | O_CREAT | O_EXCL)) < 0 || (ofh = fdopen(ofd ,"w")) == NULL)
-+ {
-+ ofd = -1;
-+ ofh = NULL;
-+ }
-
- if ( !ofh )
- {
-@@ -6875,7 +6885,7 @@ long content_length
- mod_gzip_printf( "%s: HEADER: ADDING: lbuf=[%s]",cn,npp(lbuf));
- #endif
-
-- mod_gzip_strcat( lbuf, "\r\n" );
-+ strcat( lbuf, "\r\n" );
-
- if ( send_header )
- {
-@@ -6888,7 +6898,7 @@ long content_length
- mod_gzip_printf( "%s: HEADER: ADDING: lbuf=[%s]",cn,npp(lbuf));
- #endif
-
-- mod_gzip_strcat( lbuf, "\r\n" );
-+ strcat( lbuf, "\r\n" );
-
- if ( send_header )
- {
-@@ -7283,12 +7293,12 @@ char *result_prefix_string
- prefix_string = dummy_result_prefix_string;
- }
-
-- sprintf( log_info,"%sOK", prefix_string );
-+ snprintf( log_info, sizeof(log_info),"%sOK", prefix_string );
-
- ap_table_setn(
- r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
-
-- sprintf( log_info,"%d", (int) input_size );
-+ snprintf( log_info, sizeof(log_info),"%d", (int) input_size );
- ap_table_setn( r->notes,"mod_gzip_input_size",ap_pstrdup(r->pool,log_info));
-
- #endif
-@@ -7302,7 +7312,7 @@ char *result_prefix_string
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-
-- sprintf( log_info,"%sDECLINED:NO_ILEN", prefix_string );
-+ snprintf( log_info, sizeof(log_info),"%sDECLINED:NO_ILEN", prefix_string );
-
- ap_table_setn(
- r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
-@@ -7329,7 +7339,7 @@ char *result_prefix_string
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-
-- sprintf( log_info,"%sDECLINED:TOO_SMALL", prefix_string );
-+ snprintf( log_info, sizeof(log_info),"%sDECLINED:TOO_SMALL", prefix_string );
-
- ap_table_setn(
- r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
-@@ -7364,7 +7374,7 @@ char *result_prefix_string
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-
-- sprintf( log_info,"%sDECLINED:TOO_BIG", prefix_string );
-+ snprintf( log_info, sizeof(log_info),"%sDECLINED:TOO_BIG", prefix_string );
-
- ap_table_setn(
- r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
-@@ -7396,7 +7406,8 @@ char *result_prefix_string
- mod_gzip_printf( "%s: Input source is file[%s]",cn,npp(source));
- #endif
-
-- mod_gzip_strcpy( gzp->input_filename, source );
-+ strncpy( gzp->input_filename, source, sizeof(gzp->input_filename)-1 );
-+ gzp->input_filename[sizeof(gzp->input_filename)-1] = '\0';
-
- gzp->input_ismem = 0;
- gzp->input_ismem_ibuf = 0;
-@@ -7537,10 +7548,10 @@ char *result_prefix_string
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-
-- sprintf( log_info,"%d", (int) output_size );
-+ snprintf( log_info, sizeof(log_info), "%d", (int) output_size );
- ap_table_setn( r->notes,"mod_gzip_output_size",ap_pstrdup(r->pool,log_info));
-
-- sprintf( log_info,"%d", (int) compression_ratio );
-+ snprintf( log_info, sizeof(log_info),"%d", (int) compression_ratio );
- ap_table_setn( r->notes,"mod_gzip_compression_ratio",ap_pstrdup(r->pool,log_info));
-
- #endif
-@@ -7556,7 +7567,7 @@ char *result_prefix_string
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-
-- sprintf( log_info,"%sDECLINED:NO_OLEN", prefix_string );
-+ snprintf( log_info, sizeof(log_info),"%sDECLINED:NO_OLEN", prefix_string );
-
- ap_table_setn(
- r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
-@@ -7637,7 +7648,7 @@ char *result_prefix_string
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-
-- sprintf( log_info,"%sDECLINED:ORIGINAL_SMALLER", prefix_string );
-+ snprintf( log_info, sizeof(log_info),"%sDECLINED:ORIGINAL_SMALLER", prefix_string );
-
- ap_table_setn(
- r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
-@@ -7701,7 +7712,7 @@ char *result_prefix_string
-
- #ifdef MOD_GZIP_USES_APACHE_LOGS
-
-- sprintf( log_info,"%sDECLINED:REOPEN_FAILED", prefix_string );
-+ snprintf( log_info, sizeof(log_info),"%sDECLINED:REOPEN_FAILED", prefix_string );
-
- ap_table_setn(
- r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
-@@ -7817,9 +7828,9 @@ char *result_prefix_string
-
- #ifdef MOD_GZIP_DEBUG1
- mod_gzip_translate_comerror( err, scratch2 );
-- sprintf( log_info,"%sTRANSMIT_ERROR:ISMEM:%d:%s", prefix_string, (int) err, scratch2 );
-+ snprintf( log_info, sizeof(log_info),"%sTRANSMIT_ERROR:ISMEM:%d:%s", prefix_string, (int) err, scratch2 );
- #else
-- sprintf( log_info,"%sTRANSMIT_ERROR:ISMEM:%d", prefix_string, (int) err );
-+ snprintf( log_info, sizeof(log_info),"%sTRANSMIT_ERROR:ISMEM:%d", prefix_string, (int) err );
- #endif
-
- ap_table_setn( r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
-@@ -7911,9 +7922,9 @@ char *result_prefix_string
-
- #ifdef MOD_GZIP_DEBUG1
- mod_gzip_translate_comerror( err, scratch2 );
-- sprintf( log_info,"%sTRANSMIT_ERROR:%d:%s", prefix_string, (int) err, scratch2 );
-+ snprintf( log_info, sizeof(log_info),"%sTRANSMIT_ERROR:%d:%s", prefix_string, (int) err, scratch2 );
- #else
-- sprintf( log_info,"%sTRANSMIT_ERROR:%d", prefix_string, (int) err );
-+ snprintf( log_info, sizeof(log_info),"%sTRANSMIT_ERROR:%d", prefix_string, (int) err );
- #endif
-
- ap_table_setn( r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
-@@ -8036,10 +8047,10 @@ char *result_prefix_string
-
- if ( finalize_stats )
- {
-- sprintf( log_info,"%d", (int) output_size );
-+ snprintf( log_info, sizeof(log_info),"%d", (int) output_size );
- ap_table_setn( r->notes,"mod_gzip_output_size",ap_pstrdup(r->pool,log_info));
-
-- sprintf( log_info,"%d", (int) compression_ratio );
-+ snprintf( log_info, sizeof(log_info),"%d", (int) compression_ratio );
- ap_table_setn( r->notes,"mod_gzip_compression_ratio",ap_pstrdup(r->pool,log_info));
- }
-
-@@ -8072,7 +8083,7 @@ char *mod_gzip_generate_vary_header(mod_
-
- for(i=0;i<cfg->imap_total_entries;i++) {
- if(cfg->imap[i].type == MOD_GZIP_IMAP_ISREQHEADER) {
-- mod_gzip_strncpy(name,cfg->imap[i].name,strstr(cfg->imap[i].name,":") - cfg->imap[i].name - 1);
-+ strncpy(name,cfg->imap[i].name,strstr(cfg->imap[i].name,":") - cfg->imap[i].name - 1);
- *((const char **)ap_push_array(ary)) = ap_pstrdup(p,name);
- }
- }
-@@ -8097,8 +8108,10 @@ int mod_gzip_compress_file(request_rec *
- gzc.result_code = 0;
- gzc.bytes_out = 0;
-
-- mod_gzip_strcpy(gzc.input_filename, r->filename);
-- mod_gzip_strcpy(gzc.output_filename,dest);
-+ strncpy(gzc.input_filename, r->filename, sizeof(gzc.input_filename)-1);
-+ gzc.input_filename[sizeof(gzc.input_filename)-1] = '\0';
-+ strncpy(gzc.output_filename,dest, sizeof(gzc.output_filename)-1);
-+ gzc.output_filename[sizeof(gzc.output_filename)-1] = '\0';
-
- rc = gzp_main(r,&gzc);
-
-diff -purEbB mod_gzip-1.3.26.1a/mod_gzip_debug.c mod_gzip-1.3.26.1a.fix/mod_gzip_debug.c
---- mod_gzip-1.3.26.1a/mod_gzip_debug.c 2002-10-01 09:29:49.000000000 +0200
-+++ mod_gzip-1.3.26.1a.fix/mod_gzip_debug.c 2004-01-15 15:26:20.000000000 +0100
-@@ -98,6 +98,17 @@
- #include "mod_gzip.h"
- #include "mod_gzip_debug.h"
-
-+#ifndef WIN32
-+ #include <sys/types.h>
-+ #include <sys/stat.h>
-+ #define __USE_GNU
-+ #include <fcntl.h>
-+ #ifndef O_NOFOLLOW
-+ # warning System does not know O_NOFOLLOW
-+ #define O_NOFOLLOW 0400000
-+ #endif
-+#endif
-+
- #ifdef MOD_GZIP_DEBUG1
-
- server_rec *mod_gzip_server_now = 0;
-@@ -125,7 +137,7 @@ void mod_gzip_printf( const char *fmt, .
-
- va_start( ap, fmt );
-
-- l = vsprintf( log_line, fmt, ap );
-+ l = vsnprintf( log_line, sizeof(log_line), fmt, ap );
-
- va_end(ap);
-
-@@ -136,11 +148,39 @@ void mod_gzip_printf( const char *fmt, .
-
- #else
-
-+int safe_reopen (char *file, int mode)
-+{
-+ struct stat st;
-+ struct stat st2;
-+ int fd;
-+
-+ if (lstat(file, &st) < 0)
-+ { // does not exit -> safe creation
-+ if ((fd = open(file, mode | O_EXCL | O_CREAT, 0600)) < 0)
-+ return(-1);
-+ }
-+ else
-+ { // it exists - allow only regular file which are not hardlinked
-+ if ((! S_ISREG(st.st_mode)) || st.st_nlink != 1)
-+ return(-1); // OK, lets open
-+ if ((fd = open(file, mode | O_NOFOLLOW)) < 0)
-+ return(-1);
-+ fstat(fd, &st2); // recheck that it's the same file ...
-+ if (st2.st_dev != st.st_dev || st2.st_ino != st.st_ino || st2.st_uid != st.st_uid || st2.st_nlink != 1)
-+ {
-+ close(fd);
-+ return(-1);
-+ }
-+ }
-+
-+ return(fd);
-+}
-+
- void mod_gzip_printf( const char *fmt, ... )
- {
-- int l;
-+ int l, fd;
- char *p1;
-- FILE *log;
-+ FILE *mod_gzip_log_handle;
-
- va_list ap;
-
-@@ -153,31 +193,28 @@ void mod_gzip_printf( const char *fmt, .
- long pid = (long) getpid();
- #endif
-
-+ memset(log_line, 0, sizeof(log_line));
-+
- #ifdef WIN32
- sprintf( logname, "c:\\temp\\t%ld.log",(long)pid);
- #else
-- sprintf( logname, "/tmp/t%ld.log",(long)pid);
-+ sprintf( logname, "/tmp/t%ld.log", (long)pid);
- #endif
-
-- log = fopen( logname,"a" );
--
-- if ( !log )
-- {
-- return;
-- }
-+ fd = safe_reopen(logname, O_APPEND);
-+ mod_gzip_log_handle = fdopen(fd, "a");
-
- va_start( ap, fmt );
-
-- l = vsprintf(log_line, fmt, ap);
-+ l = vsnprintf(log_line, sizeof(log_line), fmt, ap);
-
- p1=log_line;
- while((*p1!=0)&&(*p1!=13)&&(*p1!=10)) p1++;
- *p1=0;
-
-- fprintf( log, "%s\n", log_line );
--
-- fclose( log );
-+ fprintf( mod_gzip_log_handle, "%s\n", log_line );
-
-+ fclose( mod_gzip_log_handle );
- va_end(ap);
-
- return;
-@@ -305,103 +342,103 @@ int mod_gzip_log_comerror( request_rec *
-
- if ( error == WSANOTINITIALISED )
- {
-- sprintf(b[0],"%s * WSANOTINITIALISED",p);
-- sprintf(b[1],"%s * A successful WSAStartup() must occur",p);
-- sprintf(b[2],"%s * before using this WINSOCK API call.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSANOTINITIALISED",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * A successful WSAStartup() must occur",p);
-+ snprintf(b[2],sizeof(b[2]),"%s * before using this WINSOCK API call.",p);
- }
- else if ( error == WSAENETDOWN )
- {
-- sprintf(b[0],"%s * WSAENETDOWN",p);
-- sprintf(b[1],"%s * The Windows Sockets implementation has detected",p);
-- sprintf(b[2],"%s * that the network subsystem has failed.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAENETDOWN",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The Windows Sockets implementation has detected",p);
-+ snprintf(b[2],sizeof(b[2]),"%s * that the network subsystem has failed.",p);
- }
- else if ( error == WSAENOTCONN )
- {
-- sprintf(b[0],"%s * WSAENOTCONN",p);
-- sprintf(b[1],"%s * The socket is not connected.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAENOTCONN",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The socket is not connected.",p);
- }
- else if ( error == WSAEINTR )
- {
-- sprintf(b[0],"%s * WSAEINTR",p);
-- sprintf(b[1],"%s * The (blocking) call was cancelled",p);
-- sprintf(b[2],"%s * via WSACancelBlockingCall()",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAEINTR",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The (blocking) call was cancelled",p);
-+ snprintf(b[2],sizeof(b[2]),"%s * via WSACancelBlockingCall()",p);
- }
- else if ( error == WSAEINPROGRESS )
- {
-- sprintf(b[0],"%s * WSAEINPROGRESS",p);
-- sprintf(b[1],"%s * A blocking Windows Sockets operation",p);
-- sprintf(b[2],"%s * is in progress.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAEINPROGRESS",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * A blocking Windows Sockets operation",p);
-+ snprintf(b[2],sizeof(b[2]),"%s * is in progress.",p);
- }
- else if ( error == WSAENOTSOCK )
- {
-- sprintf(b[0],"%s * WSAENOTSOCK",p);
-- sprintf(b[1],"%s * The descriptor is not a socket.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAENOTSOCK",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The descriptor is not a socket.",p);
- }
- else if ( error == WSAEOPNOTSUPP )
- {
-- sprintf(b[0],"%s * WSAEOPNOTSUPP",p);
-- sprintf(b[1],"%s * MSG_OOB was specified, but the socket is",p);
-- sprintf(b[2],"%s * not of type SOCK_STREAM.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAEOPNOTSUPP",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * MSG_OOB was specified, but the socket is",p);
-+ snprintf(b[2],sizeof(b[2]),"%s * not of type SOCK_STREAM.",p);
- }
- else if ( error == WSAESHUTDOWN )
- {
-- sprintf(b[0],"%s * WSAESHUTDOWN",p);
-- sprintf(b[1],"%s * The socket has been shutdown.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAESHUTDOWN",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The socket has been shutdown.",p);
- }
- else if ( error == WSAEWOULDBLOCK )
- {
-- sprintf(b[0],"%s * WSAEWOULDBLOCK",p);
-- sprintf(b[1],"%s * The socket is marked as non-blocking",p);
-- sprintf(b[2],"%s * and receive operation would block.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAEWOULDBLOCK",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The socket is marked as non-blocking",p);
-+ snprintf(b[2],sizeof(b[2]),"%s * and receive operation would block.",p);
- }
- else if ( error == WSAEMSGSIZE )
- {
-- sprintf(b[0],"%s * WSAEMSGSIZE",p);
-- sprintf(b[1],"%s * The datagram was too large to",p);
-- sprintf(b[2],"%s * fit into the specified buffer.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAEMSGSIZE",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The datagram was too large to",p);
-+ snprintf(b[2],sizeof(b[2]),"%s * fit into the specified buffer.",p);
- }
- else if ( error == WSAEINVAL )
- {
-- sprintf(b[0],"%s * WSAEINVAL",p);
-- sprintf(b[1],"%s * The socket has not been bound with bind().",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAEINVAL",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The socket has not been bound with bind().",p);
- }
- else if ( error == WSAECONNABORTED )
- {
-- sprintf(b[0],"%s * WSAECONNABORTED",p);
-- sprintf(b[1],"%s * The virtual circuit was aborted",p);
-- sprintf(b[2],"%s * due to timeout or other failure.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAECONNABORTED",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The virtual circuit was aborted",p);
-+ snprintf(b[2],sizeof(b[2]),"%s * due to timeout or other failure.",p);
- }
- else if ( error == WSAECONNRESET )
- {
-- sprintf(b[0],"%s * WSAECONNRESET",p);
-- sprintf(b[1],"%s * The virtual circuit was reset by the remote side.",p);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSAECONNRESET",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * The virtual circuit was reset by the remote side.",p);
- }
- else
- {
-- sprintf(b[0],"%s * WSA????",p);
-- sprintf(b[1],"%s * Unexpected WINSOCK error code %d",p,error);
-+ snprintf(b[0],sizeof(b[0]),"%s * WSA????",p);
-+ snprintf(b[1],sizeof(b[1]),"%s * Unexpected WINSOCK error code %d",p,error);
- }
-
- #else
-
-- if ( error == EBADF ) sprintf(b[0],"%s * EBADF", p );
-- else if ( error == EAGAIN ) sprintf(b[0],"%s * EAGAIN",p );
-- else if ( error == EDQUOT ) sprintf(b[0],"%s * EDQUOT",p );
-- else if ( error == EFAULT ) sprintf(b[0],"%s * EFAULT",p );
-- else if ( error == EFBIG ) sprintf(b[0],"%s * EFBIG", p );
-- else if ( error == EINTR ) sprintf(b[0],"%s * EINTR", p );
-- else if ( error == EINVAL ) sprintf(b[0],"%s * EINVAL",p );
-- else if ( error == EIO ) sprintf(b[0],"%s * EIO", p );
-- else if ( error == ENOSPC ) sprintf(b[0],"%s * ENOSPC",p );
-- else if ( error == ENXIO ) sprintf(b[0],"%s * ENXIO", p );
-- else if ( error == EPIPE ) sprintf(b[0],"%s * EPIPE", p );
-- else if ( error == ERANGE ) sprintf(b[0],"%s * ERANGE",p );
-- else if ( error == EINVAL ) sprintf(b[0],"%s * EINVAL",p );
-- else if ( error == EWOULDBLOCK ) sprintf(b[0],"%s * EWOULDBLOCK",p );
-+ if ( error == EBADF ) snprintf(b[0],sizeof(b[0]),"%s * EBADF", p );
-+ else if ( error == EAGAIN ) snprintf(b[0],sizeof(b[0]),"%s * EAGAIN",p );
-+ else if ( error == EDQUOT ) snprintf(b[0],sizeof(b[0]),"%s * EDQUOT",p );
-+ else if ( error == EFAULT ) snprintf(b[0],sizeof(b[0]),"%s * EFAULT",p );
-+ else if ( error == EFBIG ) snprintf(b[0],sizeof(b[0]),"%s * EFBIG", p );
-+ else if ( error == EINTR ) snprintf(b[0],sizeof(b[0]),"%s * EINTR", p );
-+ else if ( error == EINVAL ) snprintf(b[0],sizeof(b[0]),"%s * EINVAL",p );
-+ else if ( error == EIO ) snprintf(b[0],sizeof(b[0]),"%s * EIO", p );
-+ else if ( error == ENOSPC ) snprintf(b[0],sizeof(b[0]),"%s * ENOSPC",p );
-+ else if ( error == ENXIO ) snprintf(b[0],sizeof(b[0]),"%s * ENXIO", p );
-+ else if ( error == EPIPE ) snprintf(b[0],sizeof(b[0]),"%s * EPIPE", p );
-+ else if ( error == ERANGE ) snprintf(b[0],sizeof(b[0]),"%s * ERANGE",p );
-+ else if ( error == EINVAL ) snprintf(b[0],sizeof(b[0]),"%s * EINVAL",p );
-+ else if ( error == EWOULDBLOCK ) snprintf(b[0],sizeof(b[0]),"%s * EWOULDBLOCK",p );
-
- else
- {
-- sprintf(b[0],"%s * E???? Unexpected error code %d",p,error);
-+ snprintf(b[0],sizeof(b[0]),"%s * E???? Unexpected error code %d",p,error);
- }
-
- #endif