diff options
| author | beck <> | 1999-09-29 04:37:45 +0000 |
|---|---|---|
| committer | beck <> | 1999-09-29 04:37:45 +0000 |
| commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
| tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/err/err.c | |
| parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
| download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip | |
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/err/err.c')
| -rw-r--r-- | src/lib/libcrypto/err/err.c | 185 |
1 files changed, 93 insertions, 92 deletions
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 5aef6a1259..8810d838c6 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
| @@ -57,34 +57,25 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "lhash.h" | 60 | #include <stdarg.h> |
| 61 | #include "crypto.h" | 61 | #include <openssl/lhash.h> |
| 62 | #include <openssl/crypto.h> | ||
| 62 | #include "cryptlib.h" | 63 | #include "cryptlib.h" |
| 63 | #include "buffer.h" | 64 | #include <openssl/buffer.h> |
| 64 | #include "err.h" | 65 | #include <openssl/err.h> |
| 65 | #include "crypto.h" | 66 | #include <openssl/crypto.h> |
| 66 | 67 | ||
| 67 | 68 | ||
| 68 | static LHASH *error_hash=NULL; | 69 | static LHASH *error_hash=NULL; |
| 69 | static LHASH *thread_hash=NULL; | 70 | static LHASH *thread_hash=NULL; |
| 70 | 71 | ||
| 71 | #ifndef NOPROTO | ||
| 72 | static unsigned long err_hash(ERR_STRING_DATA *a); | 72 | static unsigned long err_hash(ERR_STRING_DATA *a); |
| 73 | static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b); | 73 | static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b); |
| 74 | static unsigned long pid_hash(ERR_STATE *pid); | 74 | static unsigned long pid_hash(ERR_STATE *pid); |
| 75 | static int pid_cmp(ERR_STATE *a,ERR_STATE *pid); | 75 | static int pid_cmp(ERR_STATE *a,ERR_STATE *pid); |
| 76 | static unsigned long get_error_values(int inc,char **file,int *line, | 76 | static unsigned long get_error_values(int inc,const char **file,int *line, |
| 77 | char **data,int *flags); | 77 | const char **data,int *flags); |
| 78 | static void ERR_STATE_free(ERR_STATE *s); | 78 | static void ERR_STATE_free(ERR_STATE *s); |
| 79 | #else | ||
| 80 | static unsigned long err_hash(); | ||
| 81 | static int err_cmp(); | ||
| 82 | static unsigned long pid_hash(); | ||
| 83 | static int pid_cmp(); | ||
| 84 | static void ERR_STATE_free(); | ||
| 85 | ERR_STATE *s; | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #ifndef NO_ERR | 79 | #ifndef NO_ERR |
| 89 | static ERR_STRING_DATA ERR_str_libraries[]= | 80 | static ERR_STRING_DATA ERR_str_libraries[]= |
| 90 | { | 81 | { |
| @@ -107,6 +98,8 @@ static ERR_STRING_DATA ERR_str_libraries[]= | |||
| 107 | {ERR_PACK(ERR_LIB_PROXY,0,0) ,"Proxy routines"}, | 98 | {ERR_PACK(ERR_LIB_PROXY,0,0) ,"Proxy routines"}, |
| 108 | {ERR_PACK(ERR_LIB_BIO,0,0) ,"BIO routines"}, | 99 | {ERR_PACK(ERR_LIB_BIO,0,0) ,"BIO routines"}, |
| 109 | {ERR_PACK(ERR_LIB_PKCS7,0,0) ,"PKCS7 routines"}, | 100 | {ERR_PACK(ERR_LIB_PKCS7,0,0) ,"PKCS7 routines"}, |
| 101 | {ERR_PACK(ERR_LIB_X509V3,0,0) ,"X509 V3 routines"}, | ||
| 102 | {ERR_PACK(ERR_LIB_PKCS12,0,0) ,"PKCS12 routines"}, | ||
| 110 | {0,NULL}, | 103 | {0,NULL}, |
| 111 | }; | 104 | }; |
| 112 | 105 | ||
| @@ -123,6 +116,7 @@ static ERR_STRING_DATA ERR_str_functs[]= | |||
| 123 | #ifdef WINDOWS | 116 | #ifdef WINDOWS |
| 124 | {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"}, | 117 | {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"}, |
| 125 | #endif | 118 | #endif |
| 119 | {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, | ||
| 126 | {0,NULL}, | 120 | {0,NULL}, |
| 127 | }; | 121 | }; |
| 128 | 122 | ||
| @@ -146,8 +140,17 @@ static ERR_STRING_DATA ERR_str_reasons[]= | |||
| 146 | {ERR_R_PROXY_LIB ,"PROXY lib"}, | 140 | {ERR_R_PROXY_LIB ,"PROXY lib"}, |
| 147 | {ERR_R_BIO_LIB ,"BIO lib"}, | 141 | {ERR_R_BIO_LIB ,"BIO lib"}, |
| 148 | {ERR_R_PKCS7_LIB ,"PKCS7 lib"}, | 142 | {ERR_R_PKCS7_LIB ,"PKCS7 lib"}, |
| 143 | {ERR_R_PKCS12_LIB ,"PKCS12 lib"}, | ||
| 149 | {ERR_R_MALLOC_FAILURE ,"Malloc failure"}, | 144 | {ERR_R_MALLOC_FAILURE ,"Malloc failure"}, |
| 150 | {ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a fuction you should not call"}, | 145 | {ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a function you should not call"}, |
| 146 | {ERR_R_PASSED_NULL_PARAMETER ,"passed a null parameter"}, | ||
| 147 | {ERR_R_NESTED_ASN1_ERROR ,"nested asn1 error"}, | ||
| 148 | {ERR_R_BAD_ASN1_OBJECT_HEADER ,"bad asn1 object header"}, | ||
| 149 | {ERR_R_BAD_GET_ASN1_OBJECT_CALL ,"bad get asn1 object call"}, | ||
| 150 | {ERR_R_EXPECTING_AN_ASN1_SEQUENCE ,"expecting an asn1 sequence"}, | ||
| 151 | {ERR_R_ASN1_LENGTH_MISMATCH ,"asn1 length mismatch"}, | ||
| 152 | {ERR_R_MISSING_ASN1_EOS ,"missing asn1 eos"}, | ||
| 153 | |||
| 151 | {0,NULL}, | 154 | {0,NULL}, |
| 152 | }; | 155 | }; |
| 153 | #endif | 156 | #endif |
| @@ -161,11 +164,13 @@ static ERR_STRING_DATA ERR_str_reasons[]= | |||
| 161 | } \ | 164 | } \ |
| 162 | (p)->err_data_flags[i]=0; | 165 | (p)->err_data_flags[i]=0; |
| 163 | 166 | ||
| 164 | static void ERR_STATE_free(s) | 167 | static void ERR_STATE_free(ERR_STATE *s) |
| 165 | ERR_STATE *s; | ||
| 166 | { | 168 | { |
| 167 | int i; | 169 | int i; |
| 168 | 170 | ||
| 171 | if(s == NULL) | ||
| 172 | return; | ||
| 173 | |||
| 169 | for (i=0; i<ERR_NUM_ERRORS; i++) | 174 | for (i=0; i<ERR_NUM_ERRORS; i++) |
| 170 | { | 175 | { |
| 171 | err_clear_data(s,i); | 176 | err_clear_data(s,i); |
| @@ -173,7 +178,7 @@ ERR_STATE *s; | |||
| 173 | Free(s); | 178 | Free(s); |
| 174 | } | 179 | } |
| 175 | 180 | ||
| 176 | void ERR_load_ERR_strings() | 181 | void ERR_load_ERR_strings(void) |
| 177 | { | 182 | { |
| 178 | static int init=1; | 183 | static int init=1; |
| 179 | 184 | ||
| @@ -196,9 +201,7 @@ void ERR_load_ERR_strings() | |||
| 196 | } | 201 | } |
| 197 | } | 202 | } |
| 198 | 203 | ||
| 199 | void ERR_load_strings(lib,str) | 204 | void ERR_load_strings(int lib, ERR_STRING_DATA *str) |
| 200 | int lib; | ||
| 201 | ERR_STRING_DATA *str; | ||
| 202 | { | 205 | { |
| 203 | if (error_hash == NULL) | 206 | if (error_hash == NULL) |
| 204 | { | 207 | { |
| @@ -224,7 +227,7 @@ ERR_STRING_DATA *str; | |||
| 224 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR_HASH); | 227 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR_HASH); |
| 225 | } | 228 | } |
| 226 | 229 | ||
| 227 | void ERR_free_strings() | 230 | void ERR_free_strings(void) |
| 228 | { | 231 | { |
| 229 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | 232 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); |
| 230 | 233 | ||
| @@ -239,13 +242,30 @@ void ERR_free_strings() | |||
| 239 | 242 | ||
| 240 | /********************************************************/ | 243 | /********************************************************/ |
| 241 | 244 | ||
| 242 | void ERR_put_error(lib,func,reason,file,line) | 245 | void ERR_put_error(int lib, int func, int reason, const char *file, |
| 243 | int lib,func,reason; | 246 | int line) |
| 244 | char *file; | ||
| 245 | int line; | ||
| 246 | { | 247 | { |
| 247 | ERR_STATE *es; | 248 | ERR_STATE *es; |
| 248 | 249 | ||
| 250 | #ifdef _OSD_POSIX | ||
| 251 | /* In the BS2000-OSD POSIX subsystem, the compiler generates | ||
| 252 | * path names in the form "*POSIX(/etc/passwd)". | ||
| 253 | * This dirty hack strips them to something sensible. | ||
| 254 | * @@@ We shouldn't modify a const string, though. | ||
| 255 | */ | ||
| 256 | if (strncmp(file,"*POSIX(", sizeof("*POSIX(")-1) == 0) { | ||
| 257 | char *end; | ||
| 258 | |||
| 259 | /* Skip the "*POSIX(" prefix */ | ||
| 260 | file += sizeof("*POSIX(")-1; | ||
| 261 | end = &file[strlen(file)-1]; | ||
| 262 | if (*end == ')') | ||
| 263 | *end = '\0'; | ||
| 264 | /* Optional: use the basename of the path only. */ | ||
| 265 | if ((end = strrchr(file, '/')) != NULL) | ||
| 266 | file = &end[1]; | ||
| 267 | } | ||
| 268 | #endif | ||
| 249 | es=ERR_get_state(); | 269 | es=ERR_get_state(); |
| 250 | 270 | ||
| 251 | es->top=(es->top+1)%ERR_NUM_ERRORS; | 271 | es->top=(es->top+1)%ERR_NUM_ERRORS; |
| @@ -257,7 +277,7 @@ int line; | |||
| 257 | err_clear_data(es,es->top); | 277 | err_clear_data(es,es->top); |
| 258 | } | 278 | } |
| 259 | 279 | ||
| 260 | void ERR_clear_error() | 280 | void ERR_clear_error(void) |
| 261 | { | 281 | { |
| 262 | ERR_STATE *es; | 282 | ERR_STATE *es; |
| 263 | 283 | ||
| @@ -277,42 +297,32 @@ void ERR_clear_error() | |||
| 277 | } | 297 | } |
| 278 | 298 | ||
| 279 | 299 | ||
| 280 | unsigned long ERR_get_error() | 300 | unsigned long ERR_get_error(void) |
| 281 | { return(get_error_values(1,NULL,NULL,NULL,NULL)); } | 301 | { return(get_error_values(1,NULL,NULL,NULL,NULL)); } |
| 282 | 302 | ||
| 283 | unsigned long ERR_get_error_line(file,line) | 303 | unsigned long ERR_get_error_line(const char **file, |
| 284 | char **file; | 304 | int *line) |
| 285 | int *line; | ||
| 286 | { return(get_error_values(1,file,line,NULL,NULL)); } | 305 | { return(get_error_values(1,file,line,NULL,NULL)); } |
| 287 | 306 | ||
| 288 | unsigned long ERR_get_error_line_data(file,line,data,flags) | 307 | unsigned long ERR_get_error_line_data(const char **file, int *line, |
| 289 | char **file; | 308 | const char **data, int *flags) |
| 290 | int *line; | 309 | { return(get_error_values(1,file,line, |
| 291 | char **data; | 310 | data,flags)); } |
| 292 | int *flags; | ||
| 293 | { return(get_error_values(1,file,line,data,flags)); } | ||
| 294 | 311 | ||
| 295 | unsigned long ERR_peek_error() | 312 | unsigned long ERR_peek_error(void) |
| 296 | { return(get_error_values(0,NULL,NULL,NULL,NULL)); } | 313 | { return(get_error_values(0,NULL,NULL,NULL,NULL)); } |
| 297 | 314 | ||
| 298 | unsigned long ERR_peek_error_line(file,line) | 315 | unsigned long ERR_peek_error_line(const char **file, |
| 299 | char **file; | 316 | int *line) |
| 300 | int *line; | ||
| 301 | { return(get_error_values(0,file,line,NULL,NULL)); } | 317 | { return(get_error_values(0,file,line,NULL,NULL)); } |
| 302 | 318 | ||
| 303 | unsigned long ERR_peek_error_line_data(file,line,data,flags) | 319 | unsigned long ERR_peek_error_line_data(const char **file, int *line, |
| 304 | char **file; | 320 | const char **data, int *flags) |
| 305 | int *line; | 321 | { return(get_error_values(0,file,line, |
| 306 | char **data; | 322 | data,flags)); } |
| 307 | int *flags; | 323 | |
| 308 | { return(get_error_values(0,file,line,data,flags)); } | 324 | static unsigned long get_error_values(int inc, const char **file, int *line, |
| 309 | 325 | const char **data, int *flags) | |
| 310 | static unsigned long get_error_values(inc,file,line,data,flags) | ||
| 311 | int inc; | ||
| 312 | char **file; | ||
| 313 | int *line; | ||
| 314 | char **data; | ||
| 315 | int *flags; | ||
| 316 | { | 326 | { |
| 317 | int i=0; | 327 | int i=0; |
| 318 | ERR_STATE *es; | 328 | ERR_STATE *es; |
| @@ -361,12 +371,10 @@ int *flags; | |||
| 361 | } | 371 | } |
| 362 | 372 | ||
| 363 | /* BAD for multi-threaded, uses a local buffer if ret == NULL */ | 373 | /* BAD for multi-threaded, uses a local buffer if ret == NULL */ |
| 364 | char *ERR_error_string(e,ret) | 374 | char *ERR_error_string(unsigned long e, char *ret) |
| 365 | unsigned long e; | ||
| 366 | char *ret; | ||
| 367 | { | 375 | { |
| 368 | static char buf[256]; | 376 | static char buf[256]; |
| 369 | char *ls,*fs,*rs; | 377 | const char *ls,*fs,*rs; |
| 370 | unsigned long l,f,r; | 378 | unsigned long l,f,r; |
| 371 | int i; | 379 | int i; |
| 372 | 380 | ||
| @@ -397,18 +405,17 @@ char *ret; | |||
| 397 | return(ret); | 405 | return(ret); |
| 398 | } | 406 | } |
| 399 | 407 | ||
| 400 | LHASH *ERR_get_string_table() | 408 | LHASH *ERR_get_string_table(void) |
| 401 | { | 409 | { |
| 402 | return(error_hash); | 410 | return(error_hash); |
| 403 | } | 411 | } |
| 404 | 412 | ||
| 405 | LHASH *ERR_get_err_state_table() | 413 | LHASH *ERR_get_err_state_table(void) |
| 406 | { | 414 | { |
| 407 | return(thread_hash); | 415 | return(thread_hash); |
| 408 | } | 416 | } |
| 409 | 417 | ||
| 410 | char *ERR_lib_error_string(e) | 418 | const char *ERR_lib_error_string(unsigned long e) |
| 411 | unsigned long e; | ||
| 412 | { | 419 | { |
| 413 | ERR_STRING_DATA d,*p=NULL; | 420 | ERR_STRING_DATA d,*p=NULL; |
| 414 | unsigned long l; | 421 | unsigned long l; |
| @@ -428,8 +435,7 @@ unsigned long e; | |||
| 428 | return((p == NULL)?NULL:p->string); | 435 | return((p == NULL)?NULL:p->string); |
| 429 | } | 436 | } |
| 430 | 437 | ||
| 431 | char *ERR_func_error_string(e) | 438 | const char *ERR_func_error_string(unsigned long e) |
| 432 | unsigned long e; | ||
| 433 | { | 439 | { |
| 434 | ERR_STRING_DATA d,*p=NULL; | 440 | ERR_STRING_DATA d,*p=NULL; |
| 435 | unsigned long l,f; | 441 | unsigned long l,f; |
| @@ -450,8 +456,7 @@ unsigned long e; | |||
| 450 | return((p == NULL)?NULL:p->string); | 456 | return((p == NULL)?NULL:p->string); |
| 451 | } | 457 | } |
| 452 | 458 | ||
| 453 | char *ERR_reason_error_string(e) | 459 | const char *ERR_reason_error_string(unsigned long e) |
| 454 | unsigned long e; | ||
| 455 | { | 460 | { |
| 456 | ERR_STRING_DATA d,*p=NULL; | 461 | ERR_STRING_DATA d,*p=NULL; |
| 457 | unsigned long l,r; | 462 | unsigned long l,r; |
| @@ -478,8 +483,7 @@ unsigned long e; | |||
| 478 | return((p == NULL)?NULL:p->string); | 483 | return((p == NULL)?NULL:p->string); |
| 479 | } | 484 | } |
| 480 | 485 | ||
| 481 | static unsigned long err_hash(a) | 486 | static unsigned long err_hash(ERR_STRING_DATA *a) |
| 482 | ERR_STRING_DATA *a; | ||
| 483 | { | 487 | { |
| 484 | unsigned long ret,l; | 488 | unsigned long ret,l; |
| 485 | 489 | ||
| @@ -488,26 +492,22 @@ ERR_STRING_DATA *a; | |||
| 488 | return(ret^ret%19*13); | 492 | return(ret^ret%19*13); |
| 489 | } | 493 | } |
| 490 | 494 | ||
| 491 | static int err_cmp(a,b) | 495 | static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b) |
| 492 | ERR_STRING_DATA *a,*b; | ||
| 493 | { | 496 | { |
| 494 | return((int)(a->error-b->error)); | 497 | return((int)(a->error-b->error)); |
| 495 | } | 498 | } |
| 496 | 499 | ||
| 497 | static unsigned long pid_hash(a) | 500 | static unsigned long pid_hash(ERR_STATE *a) |
| 498 | ERR_STATE *a; | ||
| 499 | { | 501 | { |
| 500 | return(a->pid*13); | 502 | return(a->pid*13); |
| 501 | } | 503 | } |
| 502 | 504 | ||
| 503 | static int pid_cmp(a,b) | 505 | static int pid_cmp(ERR_STATE *a, ERR_STATE *b) |
| 504 | ERR_STATE *a,*b; | ||
| 505 | { | 506 | { |
| 506 | return((int)((long)a->pid - (long)b->pid)); | 507 | return((int)((long)a->pid - (long)b->pid)); |
| 507 | } | 508 | } |
| 508 | 509 | ||
| 509 | void ERR_remove_state(pid) | 510 | void ERR_remove_state(unsigned long pid) |
| 510 | unsigned long pid; | ||
| 511 | { | 511 | { |
| 512 | ERR_STATE *p,tmp; | 512 | ERR_STATE *p,tmp; |
| 513 | 513 | ||
| @@ -523,7 +523,7 @@ unsigned long pid; | |||
| 523 | if (p != NULL) ERR_STATE_free(p); | 523 | if (p != NULL) ERR_STATE_free(p); |
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | ERR_STATE *ERR_get_state() | 526 | ERR_STATE *ERR_get_state(void) |
| 527 | { | 527 | { |
| 528 | static ERR_STATE fallback; | 528 | static ERR_STATE fallback; |
| 529 | ERR_STATE *ret=NULL,tmp,*tmpp; | 529 | ERR_STATE *ret=NULL,tmp,*tmpp; |
| @@ -539,7 +539,9 @@ ERR_STATE *ERR_get_state() | |||
| 539 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | 539 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); |
| 540 | if (thread_hash == NULL) | 540 | if (thread_hash == NULL) |
| 541 | { | 541 | { |
| 542 | MemCheck_off(); | ||
| 542 | thread_hash=lh_new(pid_hash,pid_cmp); | 543 | thread_hash=lh_new(pid_hash,pid_cmp); |
| 544 | MemCheck_on(); | ||
| 543 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | 545 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); |
| 544 | if (thread_hash == NULL) return(&fallback); | 546 | if (thread_hash == NULL) return(&fallback); |
| 545 | } | 547 | } |
| @@ -577,16 +579,14 @@ ERR_STATE *ERR_get_state() | |||
| 577 | return(ret); | 579 | return(ret); |
| 578 | } | 580 | } |
| 579 | 581 | ||
| 580 | int ERR_get_next_error_library() | 582 | int ERR_get_next_error_library(void) |
| 581 | { | 583 | { |
| 582 | static int value=ERR_LIB_USER; | 584 | static int value=ERR_LIB_USER; |
| 583 | 585 | ||
| 584 | return(value++); | 586 | return(value++); |
| 585 | } | 587 | } |
| 586 | 588 | ||
| 587 | void ERR_set_error_data(data,flags) | 589 | void ERR_set_error_data(char *data, int flags) |
| 588 | char *data; | ||
| 589 | int flags; | ||
| 590 | { | 590 | { |
| 591 | ERR_STATE *es; | 591 | ERR_STATE *es; |
| 592 | int i; | 592 | int i; |
| @@ -601,10 +601,9 @@ int flags; | |||
| 601 | es->err_data_flags[es->top]=flags; | 601 | es->err_data_flags[es->top]=flags; |
| 602 | } | 602 | } |
| 603 | 603 | ||
| 604 | void ERR_add_error_data( VAR_PLIST(int , num)) | 604 | void ERR_add_error_data(int num, ...) |
| 605 | VAR_ALIST | 605 | { |
| 606 | { | 606 | va_list args; |
| 607 | VAR_BDEFN(args, int, num); | ||
| 608 | int i,n,s; | 607 | int i,n,s; |
| 609 | char *str,*p,*a; | 608 | char *str,*p,*a; |
| 610 | 609 | ||
| @@ -613,12 +612,14 @@ VAR_ALIST | |||
| 613 | if (str == NULL) return; | 612 | if (str == NULL) return; |
| 614 | str[0]='\0'; | 613 | str[0]='\0'; |
| 615 | 614 | ||
| 616 | VAR_INIT(args,int,num); | 615 | va_start(args, num); |
| 617 | n=0; | 616 | n=0; |
| 618 | for (i=0; i<num; i++) | 617 | for (i=0; i<num; i++) |
| 619 | { | 618 | { |
| 620 | VAR_ARG(args,char *,a); | 619 | a=va_arg(args, char*); |
| 621 | if (a != NULL) { | 620 | /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */ |
| 621 | if (a != NULL) | ||
| 622 | { | ||
| 622 | n+=strlen(a); | 623 | n+=strlen(a); |
| 623 | if (n > s) | 624 | if (n > s) |
| 624 | { | 625 | { |
| @@ -637,6 +638,6 @@ VAR_ALIST | |||
| 637 | } | 638 | } |
| 638 | ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING); | 639 | ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING); |
| 639 | 640 | ||
| 640 | VAR_END( args ); | 641 | va_end(args); |
| 641 | } | 642 | } |
| 642 | 643 | ||
