diff options
| author | beck <> | 2014-04-26 18:56:38 +0000 |
|---|---|---|
| committer | beck <> | 2014-04-26 18:56:38 +0000 |
| commit | e7dbd7a1e2ad3e12dafa2919bc8603d60416ea4d (patch) | |
| tree | dff54039de6c4454b05953e2ce78edfc5693e6b5 /src/lib/libcrypto/bio/b_sock.c | |
| parent | a1c73b72875dcb25545f111b3779cf0f0ebf9c88 (diff) | |
| download | openbsd-e7dbd7a1e2ad3e12dafa2919bc8603d60416ea4d.tar.gz openbsd-e7dbd7a1e2ad3e12dafa2919bc8603d60416ea4d.tar.bz2 openbsd-e7dbd7a1e2ad3e12dafa2919bc8603d60416ea4d.zip | |
Replace all use of ERR_add_error_data with ERR_asprintf_error_data.
This avoids a lot of ugly gymnastics to do snprintfs before sending the
bag of strings to ERR, and eliminates at least one place in dso_dlfctn.c
where it was being called with the incorrect number of arguments and
using random things off the stack as addresses of strings.
ok krw@, jsing@
Diffstat (limited to 'src/lib/libcrypto/bio/b_sock.c')
| -rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index 05eb362cc6..ecfaf93b99 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
| @@ -129,7 +129,7 @@ err: | |||
| 129 | if (locked) | 129 | if (locked) |
| 130 | CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); | 130 | CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); |
| 131 | if (err) { | 131 | if (err) { |
| 132 | ERR_add_error_data(2, "host=", str); | 132 | ERR_asprintf_error_data("host=%s", str); |
| 133 | return 0; | 133 | return 0; |
| 134 | } else | 134 | } else |
| 135 | return 1; | 135 | return 1; |
| @@ -171,7 +171,7 @@ BIO_get_port(const char *str, unsigned short *port_ptr) | |||
| 171 | *port_ptr = 70; | 171 | *port_ptr = 70; |
| 172 | else { | 172 | else { |
| 173 | SYSerr(SYS_F_GETSERVBYNAME, errno); | 173 | SYSerr(SYS_F_GETSERVBYNAME, errno); |
| 174 | ERR_add_error_data(3, "service='", str, "'"); | 174 | ERR_asprintf_error_data("service='%s'", str); |
| 175 | return (0); | 175 | return (0); |
| 176 | } | 176 | } |
| 177 | } | 177 | } |
| @@ -378,7 +378,7 @@ again: | |||
| 378 | s = socket(server.sa.sa_family, SOCK_STREAM, SOCKET_PROTOCOL); | 378 | s = socket(server.sa.sa_family, SOCK_STREAM, SOCKET_PROTOCOL); |
| 379 | if (s == -1) { | 379 | if (s == -1) { |
| 380 | SYSerr(SYS_F_SOCKET, errno); | 380 | SYSerr(SYS_F_SOCKET, errno); |
| 381 | ERR_add_error_data(3, "port='", host, "'"); | 381 | ERR_asprintf_error_data("port='%s'", host); |
| 382 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_CREATE_SOCKET); | 382 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_CREATE_SOCKET); |
| 383 | goto err; | 383 | goto err; |
| 384 | } | 384 | } |
| @@ -422,13 +422,13 @@ again: | |||
| 422 | } | 422 | } |
| 423 | #endif | 423 | #endif |
| 424 | SYSerr(SYS_F_BIND, err_num); | 424 | SYSerr(SYS_F_BIND, err_num); |
| 425 | ERR_add_error_data(3, "port='", host, "'"); | 425 | ERR_asprintf_error_data("port='%s'", host); |
| 426 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_BIND_SOCKET); | 426 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_BIND_SOCKET); |
| 427 | goto err; | 427 | goto err; |
| 428 | } | 428 | } |
| 429 | if (listen(s, MAX_LISTEN) == -1) { | 429 | if (listen(s, MAX_LISTEN) == -1) { |
| 430 | SYSerr(SYS_F_BIND, errno); | 430 | SYSerr(SYS_F_BIND, errno); |
| 431 | ERR_add_error_data(3, "port='", host, "'"); | 431 | ERR_asprintf_error_data("port='%s'", host); |
| 432 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_LISTEN_SOCKET); | 432 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_LISTEN_SOCKET); |
| 433 | goto err; | 433 | goto err; |
| 434 | } | 434 | } |
