1 fixes CAN-2003-0842, CAN-2003-0843, CAN-2003-0844
2 taken from SuSE apache-contrib package updates
4 diff -purEbB mod_gzip-1.3.26.1a/mod_gzip.c mod_gzip-1.3.26.1a.fix/mod_gzip.c
5 --- mod_gzip-1.3.26.1a/mod_gzip.c 2002-10-01 09:29:49.000000000 +0200
6 +++ mod_gzip-1.3.26.1a.fix/mod_gzip.c 2004-01-13 17:16:05.000000000 +0100
11 +#include <sys/types.h>
12 +#include <sys/stat.h>
16 #include "http_config.h"
17 #include "http_core.h"
18 @@ -1382,8 +1386,8 @@ int targetmaxlen
25 + target, targetmaxlen,
26 "%s%s_%ld_%ld_%ld.wrk",
29 @@ -1394,8 +1398,8 @@ int targetmaxlen
36 + target, targetmaxlen,
40 @@ -3631,7 +3635,7 @@ mod_gzip_set_temp_dir( cmd_parms *parms,
41 if ( ( *(mgc->temp_dir+(arglen-1)) != '\\' ) &&
42 ( *(mgc->temp_dir+(arglen-1)) != '/' ) )
44 - mod_gzip_strcat( mgc->temp_dir, dirsep );
45 + strcat( mgc->temp_dir, dirsep );
48 rc = stat( mgc->temp_dir, &sbuf );
49 @@ -3734,7 +3738,8 @@ static const char *mod_gzip_static_suffi
50 return "mod_gzip_static_suffix: suffix to long!";
53 - mod_gzip_strcpy(mgc->suffix,arg1);
54 + strncpy(mgc->suffix,arg1,sizeof(mgc->suffix)-1);
55 + mgc->suffix[sizeof(mgc->suffix)-1] = '\0';
59 @@ -5221,8 +5226,9 @@ mod_gzip_conf *dconf,
71 @@ -5763,7 +5769,7 @@ char *input_filename
74 #ifdef MOD_GZIP_USES_APACHE_LOGS
75 - mod_gzip_strcat( lbuf, ":NO_200");
76 + strcat( lbuf, ":NO_200");
80 @@ -5778,7 +5784,7 @@ char *input_filename
83 #ifdef MOD_GZIP_USES_APACHE_LOGS
84 - mod_gzip_strcat( lbuf, ":RESPONSE_FIELD_EXCLUDED");
85 + strcat( lbuf, ":RESPONSE_FIELD_EXCLUDED");
89 @@ -5793,7 +5799,7 @@ char *input_filename
92 #ifdef MOD_GZIP_USES_APACHE_LOGS
93 - mod_gzip_strcat( lbuf, ":NO_BODY");
94 + strcat( lbuf, ":NO_BODY");
98 @@ -5807,7 +5813,7 @@ char *input_filename
101 #ifdef MOD_GZIP_USES_APACHE_LOGS
102 - mod_gzip_strcat( lbuf, ":UNKNOWN_TE_VALUE");
103 + strcat( lbuf, ":UNKNOWN_TE_VALUE");
107 @@ -5821,7 +5827,7 @@ char *input_filename
110 #ifdef MOD_GZIP_USES_APACHE_LOGS
111 - mod_gzip_strcat( lbuf, ":HAS_CE");
112 + strcat( lbuf, ":HAS_CE");
116 @@ -5835,7 +5841,7 @@ char *input_filename
119 #ifdef MOD_GZIP_USES_APACHE_LOGS
120 - mod_gzip_strcat( lbuf, ":NO_CONTENT_TYPE_IN_RESPONSE_HEADER");
121 + strcat( lbuf, ":NO_CONTENT_TYPE_IN_RESPONSE_HEADER");
124 else if ( !send_as_is )
125 @@ -5891,7 +5897,7 @@ char *input_filename
128 #ifdef MOD_GZIP_USES_APACHE_LOGS
129 - mod_gzip_strcat( lbuf, ":RESPONSE_CONTENT_TYPE_EXCLUDED");
130 + strcat( lbuf, ":RESPONSE_CONTENT_TYPE_EXCLUDED");
134 @@ -6041,7 +6047,11 @@ char *input_filename
135 mod_gzip_printf( "%s: Call OUTPUT fopen(%s)...",cn,npp(output_filename1));
138 - ofh = fopen( output_filename1, "wb" );
139 + if( (ofd = open(output_filename1, O_WRONLY | O_CREAT | O_EXCL)) < 0 || (ofh = fdopen(ofd ,"w")) == NULL)
147 @@ -6875,7 +6885,7 @@ long content_length
148 mod_gzip_printf( "%s: HEADER: ADDING: lbuf=[%s]",cn,npp(lbuf));
151 - mod_gzip_strcat( lbuf, "\r\n" );
152 + strcat( lbuf, "\r\n" );
156 @@ -6888,7 +6898,7 @@ long content_length
157 mod_gzip_printf( "%s: HEADER: ADDING: lbuf=[%s]",cn,npp(lbuf));
160 - mod_gzip_strcat( lbuf, "\r\n" );
161 + strcat( lbuf, "\r\n" );
165 @@ -7283,12 +7293,12 @@ char *result_prefix_string
166 prefix_string = dummy_result_prefix_string;
169 - sprintf( log_info,"%sOK", prefix_string );
170 + snprintf( log_info, sizeof(log_info),"%sOK", prefix_string );
173 r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
175 - sprintf( log_info,"%d", (int) input_size );
176 + snprintf( log_info, sizeof(log_info),"%d", (int) input_size );
177 ap_table_setn( r->notes,"mod_gzip_input_size",ap_pstrdup(r->pool,log_info));
180 @@ -7302,7 +7312,7 @@ char *result_prefix_string
182 #ifdef MOD_GZIP_USES_APACHE_LOGS
184 - sprintf( log_info,"%sDECLINED:NO_ILEN", prefix_string );
185 + snprintf( log_info, sizeof(log_info),"%sDECLINED:NO_ILEN", prefix_string );
188 r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
189 @@ -7329,7 +7339,7 @@ char *result_prefix_string
191 #ifdef MOD_GZIP_USES_APACHE_LOGS
193 - sprintf( log_info,"%sDECLINED:TOO_SMALL", prefix_string );
194 + snprintf( log_info, sizeof(log_info),"%sDECLINED:TOO_SMALL", prefix_string );
197 r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
198 @@ -7364,7 +7374,7 @@ char *result_prefix_string
200 #ifdef MOD_GZIP_USES_APACHE_LOGS
202 - sprintf( log_info,"%sDECLINED:TOO_BIG", prefix_string );
203 + snprintf( log_info, sizeof(log_info),"%sDECLINED:TOO_BIG", prefix_string );
206 r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
207 @@ -7396,7 +7406,8 @@ char *result_prefix_string
208 mod_gzip_printf( "%s: Input source is file[%s]",cn,npp(source));
211 - mod_gzip_strcpy( gzp->input_filename, source );
212 + strncpy( gzp->input_filename, source, sizeof(gzp->input_filename)-1 );
213 + gzp->input_filename[sizeof(gzp->input_filename)-1] = '\0';
215 gzp->input_ismem = 0;
216 gzp->input_ismem_ibuf = 0;
217 @@ -7537,10 +7548,10 @@ char *result_prefix_string
219 #ifdef MOD_GZIP_USES_APACHE_LOGS
221 - sprintf( log_info,"%d", (int) output_size );
222 + snprintf( log_info, sizeof(log_info), "%d", (int) output_size );
223 ap_table_setn( r->notes,"mod_gzip_output_size",ap_pstrdup(r->pool,log_info));
225 - sprintf( log_info,"%d", (int) compression_ratio );
226 + snprintf( log_info, sizeof(log_info),"%d", (int) compression_ratio );
227 ap_table_setn( r->notes,"mod_gzip_compression_ratio",ap_pstrdup(r->pool,log_info));
230 @@ -7556,7 +7567,7 @@ char *result_prefix_string
232 #ifdef MOD_GZIP_USES_APACHE_LOGS
234 - sprintf( log_info,"%sDECLINED:NO_OLEN", prefix_string );
235 + snprintf( log_info, sizeof(log_info),"%sDECLINED:NO_OLEN", prefix_string );
238 r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
239 @@ -7637,7 +7648,7 @@ char *result_prefix_string
241 #ifdef MOD_GZIP_USES_APACHE_LOGS
243 - sprintf( log_info,"%sDECLINED:ORIGINAL_SMALLER", prefix_string );
244 + snprintf( log_info, sizeof(log_info),"%sDECLINED:ORIGINAL_SMALLER", prefix_string );
247 r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
248 @@ -7701,7 +7712,7 @@ char *result_prefix_string
250 #ifdef MOD_GZIP_USES_APACHE_LOGS
252 - sprintf( log_info,"%sDECLINED:REOPEN_FAILED", prefix_string );
253 + snprintf( log_info, sizeof(log_info),"%sDECLINED:REOPEN_FAILED", prefix_string );
256 r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
257 @@ -7817,9 +7828,9 @@ char *result_prefix_string
259 #ifdef MOD_GZIP_DEBUG1
260 mod_gzip_translate_comerror( err, scratch2 );
261 - sprintf( log_info,"%sTRANSMIT_ERROR:ISMEM:%d:%s", prefix_string, (int) err, scratch2 );
262 + snprintf( log_info, sizeof(log_info),"%sTRANSMIT_ERROR:ISMEM:%d:%s", prefix_string, (int) err, scratch2 );
264 - sprintf( log_info,"%sTRANSMIT_ERROR:ISMEM:%d", prefix_string, (int) err );
265 + snprintf( log_info, sizeof(log_info),"%sTRANSMIT_ERROR:ISMEM:%d", prefix_string, (int) err );
268 ap_table_setn( r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
269 @@ -7911,9 +7922,9 @@ char *result_prefix_string
271 #ifdef MOD_GZIP_DEBUG1
272 mod_gzip_translate_comerror( err, scratch2 );
273 - sprintf( log_info,"%sTRANSMIT_ERROR:%d:%s", prefix_string, (int) err, scratch2 );
274 + snprintf( log_info, sizeof(log_info),"%sTRANSMIT_ERROR:%d:%s", prefix_string, (int) err, scratch2 );
276 - sprintf( log_info,"%sTRANSMIT_ERROR:%d", prefix_string, (int) err );
277 + snprintf( log_info, sizeof(log_info),"%sTRANSMIT_ERROR:%d", prefix_string, (int) err );
280 ap_table_setn( r->notes,"mod_gzip_result",ap_pstrdup(r->pool,log_info));
281 @@ -8036,10 +8047,10 @@ char *result_prefix_string
283 if ( finalize_stats )
285 - sprintf( log_info,"%d", (int) output_size );
286 + snprintf( log_info, sizeof(log_info),"%d", (int) output_size );
287 ap_table_setn( r->notes,"mod_gzip_output_size",ap_pstrdup(r->pool,log_info));
289 - sprintf( log_info,"%d", (int) compression_ratio );
290 + snprintf( log_info, sizeof(log_info),"%d", (int) compression_ratio );
291 ap_table_setn( r->notes,"mod_gzip_compression_ratio",ap_pstrdup(r->pool,log_info));
294 @@ -8072,7 +8083,7 @@ char *mod_gzip_generate_vary_header(mod_
296 for(i=0;i<cfg->imap_total_entries;i++) {
297 if(cfg->imap[i].type == MOD_GZIP_IMAP_ISREQHEADER) {
298 - mod_gzip_strncpy(name,cfg->imap[i].name,strstr(cfg->imap[i].name,":") - cfg->imap[i].name - 1);
299 + strncpy(name,cfg->imap[i].name,strstr(cfg->imap[i].name,":") - cfg->imap[i].name - 1);
300 *((const char **)ap_push_array(ary)) = ap_pstrdup(p,name);
303 @@ -8097,8 +8108,10 @@ int mod_gzip_compress_file(request_rec *
307 - mod_gzip_strcpy(gzc.input_filename, r->filename);
308 - mod_gzip_strcpy(gzc.output_filename,dest);
309 + strncpy(gzc.input_filename, r->filename, sizeof(gzc.input_filename)-1);
310 + gzc.input_filename[sizeof(gzc.input_filename)-1] = '\0';
311 + strncpy(gzc.output_filename,dest, sizeof(gzc.output_filename)-1);
312 + gzc.output_filename[sizeof(gzc.output_filename)-1] = '\0';
314 rc = gzp_main(r,&gzc);
316 diff -purEbB mod_gzip-1.3.26.1a/mod_gzip_debug.c mod_gzip-1.3.26.1a.fix/mod_gzip_debug.c
317 --- mod_gzip-1.3.26.1a/mod_gzip_debug.c 2002-10-01 09:29:49.000000000 +0200
318 +++ mod_gzip-1.3.26.1a.fix/mod_gzip_debug.c 2004-01-15 15:26:20.000000000 +0100
320 #include "mod_gzip.h"
321 #include "mod_gzip_debug.h"
324 + #include <sys/types.h>
325 + #include <sys/stat.h>
329 + # warning System does not know O_NOFOLLOW
330 + #define O_NOFOLLOW 0400000
334 #ifdef MOD_GZIP_DEBUG1
336 server_rec *mod_gzip_server_now = 0;
337 @@ -125,7 +137,7 @@ void mod_gzip_printf( const char *fmt, .
341 - l = vsprintf( log_line, fmt, ap );
342 + l = vsnprintf( log_line, sizeof(log_line), fmt, ap );
346 @@ -136,11 +148,39 @@ void mod_gzip_printf( const char *fmt, .
350 +int safe_reopen (char *file, int mode)
356 + if (lstat(file, &st) < 0)
357 + { // does not exit -> safe creation
358 + if ((fd = open(file, mode | O_EXCL | O_CREAT, 0600)) < 0)
362 + { // it exists - allow only regular file which are not hardlinked
363 + if ((! S_ISREG(st.st_mode)) || st.st_nlink != 1)
364 + return(-1); // OK, lets open
365 + if ((fd = open(file, mode | O_NOFOLLOW)) < 0)
367 + fstat(fd, &st2); // recheck that it's the same file ...
368 + if (st2.st_dev != st.st_dev || st2.st_ino != st.st_ino || st2.st_uid != st.st_uid || st2.st_nlink != 1)
378 void mod_gzip_printf( const char *fmt, ... )
384 + FILE *mod_gzip_log_handle;
388 @@ -153,31 +193,28 @@ void mod_gzip_printf( const char *fmt, .
389 long pid = (long) getpid();
392 + memset(log_line, 0, sizeof(log_line));
395 sprintf( logname, "c:\\temp\\t%ld.log",(long)pid);
397 - sprintf( logname, "/tmp/t%ld.log",(long)pid);
398 + sprintf( logname, "/tmp/t%ld.log", (long)pid);
401 - log = fopen( logname,"a" );
407 + fd = safe_reopen(logname, O_APPEND);
408 + mod_gzip_log_handle = fdopen(fd, "a");
412 - l = vsprintf(log_line, fmt, ap);
413 + l = vsnprintf(log_line, sizeof(log_line), fmt, ap);
416 while((*p1!=0)&&(*p1!=13)&&(*p1!=10)) p1++;
419 - fprintf( log, "%s\n", log_line );
422 + fprintf( mod_gzip_log_handle, "%s\n", log_line );
424 + fclose( mod_gzip_log_handle );
428 @@ -305,103 +342,103 @@ int mod_gzip_log_comerror( request_rec *
430 if ( error == WSANOTINITIALISED )
432 - sprintf(b[0],"%s * WSANOTINITIALISED",p);
433 - sprintf(b[1],"%s * A successful WSAStartup() must occur",p);
434 - sprintf(b[2],"%s * before using this WINSOCK API call.",p);
435 + snprintf(b[0],sizeof(b[0]),"%s * WSANOTINITIALISED",p);
436 + snprintf(b[1],sizeof(b[1]),"%s * A successful WSAStartup() must occur",p);
437 + snprintf(b[2],sizeof(b[2]),"%s * before using this WINSOCK API call.",p);
439 else if ( error == WSAENETDOWN )
441 - sprintf(b[0],"%s * WSAENETDOWN",p);
442 - sprintf(b[1],"%s * The Windows Sockets implementation has detected",p);
443 - sprintf(b[2],"%s * that the network subsystem has failed.",p);
444 + snprintf(b[0],sizeof(b[0]),"%s * WSAENETDOWN",p);
445 + snprintf(b[1],sizeof(b[1]),"%s * The Windows Sockets implementation has detected",p);
446 + snprintf(b[2],sizeof(b[2]),"%s * that the network subsystem has failed.",p);
448 else if ( error == WSAENOTCONN )
450 - sprintf(b[0],"%s * WSAENOTCONN",p);
451 - sprintf(b[1],"%s * The socket is not connected.",p);
452 + snprintf(b[0],sizeof(b[0]),"%s * WSAENOTCONN",p);
453 + snprintf(b[1],sizeof(b[1]),"%s * The socket is not connected.",p);
455 else if ( error == WSAEINTR )
457 - sprintf(b[0],"%s * WSAEINTR",p);
458 - sprintf(b[1],"%s * The (blocking) call was cancelled",p);
459 - sprintf(b[2],"%s * via WSACancelBlockingCall()",p);
460 + snprintf(b[0],sizeof(b[0]),"%s * WSAEINTR",p);
461 + snprintf(b[1],sizeof(b[1]),"%s * The (blocking) call was cancelled",p);
462 + snprintf(b[2],sizeof(b[2]),"%s * via WSACancelBlockingCall()",p);
464 else if ( error == WSAEINPROGRESS )
466 - sprintf(b[0],"%s * WSAEINPROGRESS",p);
467 - sprintf(b[1],"%s * A blocking Windows Sockets operation",p);
468 - sprintf(b[2],"%s * is in progress.",p);
469 + snprintf(b[0],sizeof(b[0]),"%s * WSAEINPROGRESS",p);
470 + snprintf(b[1],sizeof(b[1]),"%s * A blocking Windows Sockets operation",p);
471 + snprintf(b[2],sizeof(b[2]),"%s * is in progress.",p);
473 else if ( error == WSAENOTSOCK )
475 - sprintf(b[0],"%s * WSAENOTSOCK",p);
476 - sprintf(b[1],"%s * The descriptor is not a socket.",p);
477 + snprintf(b[0],sizeof(b[0]),"%s * WSAENOTSOCK",p);
478 + snprintf(b[1],sizeof(b[1]),"%s * The descriptor is not a socket.",p);
480 else if ( error == WSAEOPNOTSUPP )
482 - sprintf(b[0],"%s * WSAEOPNOTSUPP",p);
483 - sprintf(b[1],"%s * MSG_OOB was specified, but the socket is",p);
484 - sprintf(b[2],"%s * not of type SOCK_STREAM.",p);
485 + snprintf(b[0],sizeof(b[0]),"%s * WSAEOPNOTSUPP",p);
486 + snprintf(b[1],sizeof(b[1]),"%s * MSG_OOB was specified, but the socket is",p);
487 + snprintf(b[2],sizeof(b[2]),"%s * not of type SOCK_STREAM.",p);
489 else if ( error == WSAESHUTDOWN )
491 - sprintf(b[0],"%s * WSAESHUTDOWN",p);
492 - sprintf(b[1],"%s * The socket has been shutdown.",p);
493 + snprintf(b[0],sizeof(b[0]),"%s * WSAESHUTDOWN",p);
494 + snprintf(b[1],sizeof(b[1]),"%s * The socket has been shutdown.",p);
496 else if ( error == WSAEWOULDBLOCK )
498 - sprintf(b[0],"%s * WSAEWOULDBLOCK",p);
499 - sprintf(b[1],"%s * The socket is marked as non-blocking",p);
500 - sprintf(b[2],"%s * and receive operation would block.",p);
501 + snprintf(b[0],sizeof(b[0]),"%s * WSAEWOULDBLOCK",p);
502 + snprintf(b[1],sizeof(b[1]),"%s * The socket is marked as non-blocking",p);
503 + snprintf(b[2],sizeof(b[2]),"%s * and receive operation would block.",p);
505 else if ( error == WSAEMSGSIZE )
507 - sprintf(b[0],"%s * WSAEMSGSIZE",p);
508 - sprintf(b[1],"%s * The datagram was too large to",p);
509 - sprintf(b[2],"%s * fit into the specified buffer.",p);
510 + snprintf(b[0],sizeof(b[0]),"%s * WSAEMSGSIZE",p);
511 + snprintf(b[1],sizeof(b[1]),"%s * The datagram was too large to",p);
512 + snprintf(b[2],sizeof(b[2]),"%s * fit into the specified buffer.",p);
514 else if ( error == WSAEINVAL )
516 - sprintf(b[0],"%s * WSAEINVAL",p);
517 - sprintf(b[1],"%s * The socket has not been bound with bind().",p);
518 + snprintf(b[0],sizeof(b[0]),"%s * WSAEINVAL",p);
519 + snprintf(b[1],sizeof(b[1]),"%s * The socket has not been bound with bind().",p);
521 else if ( error == WSAECONNABORTED )
523 - sprintf(b[0],"%s * WSAECONNABORTED",p);
524 - sprintf(b[1],"%s * The virtual circuit was aborted",p);
525 - sprintf(b[2],"%s * due to timeout or other failure.",p);
526 + snprintf(b[0],sizeof(b[0]),"%s * WSAECONNABORTED",p);
527 + snprintf(b[1],sizeof(b[1]),"%s * The virtual circuit was aborted",p);
528 + snprintf(b[2],sizeof(b[2]),"%s * due to timeout or other failure.",p);
530 else if ( error == WSAECONNRESET )
532 - sprintf(b[0],"%s * WSAECONNRESET",p);
533 - sprintf(b[1],"%s * The virtual circuit was reset by the remote side.",p);
534 + snprintf(b[0],sizeof(b[0]),"%s * WSAECONNRESET",p);
535 + snprintf(b[1],sizeof(b[1]),"%s * The virtual circuit was reset by the remote side.",p);
539 - sprintf(b[0],"%s * WSA????",p);
540 - sprintf(b[1],"%s * Unexpected WINSOCK error code %d",p,error);
541 + snprintf(b[0],sizeof(b[0]),"%s * WSA????",p);
542 + snprintf(b[1],sizeof(b[1]),"%s * Unexpected WINSOCK error code %d",p,error);
547 - if ( error == EBADF ) sprintf(b[0],"%s * EBADF", p );
548 - else if ( error == EAGAIN ) sprintf(b[0],"%s * EAGAIN",p );
549 - else if ( error == EDQUOT ) sprintf(b[0],"%s * EDQUOT",p );
550 - else if ( error == EFAULT ) sprintf(b[0],"%s * EFAULT",p );
551 - else if ( error == EFBIG ) sprintf(b[0],"%s * EFBIG", p );
552 - else if ( error == EINTR ) sprintf(b[0],"%s * EINTR", p );
553 - else if ( error == EINVAL ) sprintf(b[0],"%s * EINVAL",p );
554 - else if ( error == EIO ) sprintf(b[0],"%s * EIO", p );
555 - else if ( error == ENOSPC ) sprintf(b[0],"%s * ENOSPC",p );
556 - else if ( error == ENXIO ) sprintf(b[0],"%s * ENXIO", p );
557 - else if ( error == EPIPE ) sprintf(b[0],"%s * EPIPE", p );
558 - else if ( error == ERANGE ) sprintf(b[0],"%s * ERANGE",p );
559 - else if ( error == EINVAL ) sprintf(b[0],"%s * EINVAL",p );
560 - else if ( error == EWOULDBLOCK ) sprintf(b[0],"%s * EWOULDBLOCK",p );
561 + if ( error == EBADF ) snprintf(b[0],sizeof(b[0]),"%s * EBADF", p );
562 + else if ( error == EAGAIN ) snprintf(b[0],sizeof(b[0]),"%s * EAGAIN",p );
563 + else if ( error == EDQUOT ) snprintf(b[0],sizeof(b[0]),"%s * EDQUOT",p );
564 + else if ( error == EFAULT ) snprintf(b[0],sizeof(b[0]),"%s * EFAULT",p );
565 + else if ( error == EFBIG ) snprintf(b[0],sizeof(b[0]),"%s * EFBIG", p );
566 + else if ( error == EINTR ) snprintf(b[0],sizeof(b[0]),"%s * EINTR", p );
567 + else if ( error == EINVAL ) snprintf(b[0],sizeof(b[0]),"%s * EINVAL",p );
568 + else if ( error == EIO ) snprintf(b[0],sizeof(b[0]),"%s * EIO", p );
569 + else if ( error == ENOSPC ) snprintf(b[0],sizeof(b[0]),"%s * ENOSPC",p );
570 + else if ( error == ENXIO ) snprintf(b[0],sizeof(b[0]),"%s * ENXIO", p );
571 + else if ( error == EPIPE ) snprintf(b[0],sizeof(b[0]),"%s * EPIPE", p );
572 + else if ( error == ERANGE ) snprintf(b[0],sizeof(b[0]),"%s * ERANGE",p );
573 + else if ( error == EINVAL ) snprintf(b[0],sizeof(b[0]),"%s * EINVAL",p );
574 + else if ( error == EWOULDBLOCK ) snprintf(b[0],sizeof(b[0]),"%s * EWOULDBLOCK",p );
578 - sprintf(b[0],"%s * E???? Unexpected error code %d",p,error);
579 + snprintf(b[0],sizeof(b[0]),"%s * E???? Unexpected error code %d",p,error);