diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2014-04-26 18:56:39 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2014-04-26 18:56:39 +0000 |
commit | 1fd4e6d6b040074c7db59f84c56338d7d32a16e8 (patch) | |
tree | 6b7b603cd16600155ef930dd0a5b06ffbb8bbc68 /lib/libcrypto/bio/b_sock.c | |
parent | cef6049dc1fb7aae1575d139bab01952d0de2a62 (diff) |
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 'lib/libcrypto/bio/b_sock.c')
-rw-r--r-- | lib/libcrypto/bio/b_sock.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libcrypto/bio/b_sock.c b/lib/libcrypto/bio/b_sock.c index 05eb362cc6d..ecfaf93b99d 100644 --- a/lib/libcrypto/bio/b_sock.c +++ b/lib/libcrypto/bio/b_sock.c @@ -129,7 +129,7 @@ err: if (locked) CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); if (err) { - ERR_add_error_data(2, "host=", str); + ERR_asprintf_error_data("host=%s", str); return 0; } else return 1; @@ -171,7 +171,7 @@ BIO_get_port(const char *str, unsigned short *port_ptr) *port_ptr = 70; else { SYSerr(SYS_F_GETSERVBYNAME, errno); - ERR_add_error_data(3, "service='", str, "'"); + ERR_asprintf_error_data("service='%s'", str); return (0); } } @@ -378,7 +378,7 @@ again: s = socket(server.sa.sa_family, SOCK_STREAM, SOCKET_PROTOCOL); if (s == -1) { SYSerr(SYS_F_SOCKET, errno); - ERR_add_error_data(3, "port='", host, "'"); + ERR_asprintf_error_data("port='%s'", host); BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_CREATE_SOCKET); goto err; } @@ -422,13 +422,13 @@ again: } #endif SYSerr(SYS_F_BIND, err_num); - ERR_add_error_data(3, "port='", host, "'"); + ERR_asprintf_error_data("port='%s'", host); BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_BIND_SOCKET); goto err; } if (listen(s, MAX_LISTEN) == -1) { SYSerr(SYS_F_BIND, errno); - ERR_add_error_data(3, "port='", host, "'"); + ERR_asprintf_error_data("port='%s'", host); BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_LISTEN_SOCKET); goto err; } |