summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2014-04-15 20:14:23 +0000
committerbeck <beck@openbsd.org>2014-04-15 20:14:23 +0000
commit1cab4cf8ce9307e1e5aed68e7201d7a566b9d6e6 (patch)
tree72ba0d0721275c2cd94a06972cdffd75e2ff3d0b
parentJust like every web browser expands until it can read mail, every modular (diff)
downloadwireguard-openbsd-1cab4cf8ce9307e1e5aed68e7201d7a566b9d6e6.tar.xz
wireguard-openbsd-1cab4cf8ce9307e1e5aed68e7201d7a566b9d6e6.zip
convert BIO_snprintf to snprintf
ok deraadt@ tedu@
-rw-r--r--lib/libssl/src/apps/s_client.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libssl/src/apps/s_client.c b/lib/libssl/src/apps/s_client.c
index 87fd958cbd2..e9840ddf097 100644
--- a/lib/libssl/src/apps/s_client.c
+++ b/lib/libssl/src/apps/s_client.c
@@ -230,11 +230,15 @@ static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identity,
unsigned int max_psk_len)
{
unsigned int psk_len = 0;
+ size_t maxlen = 0;
int ret;
BIGNUM *bn=NULL;
if (c_debug)
BIO_printf(bio_c_out, "psk_client_cb\n");
+ if (max_identity_len > INT_MAX)
+ goto out_err;
+ maxlen = max_identity_len;
if (!hint)
{
/* no ServerKeyExchange message*/
@@ -245,8 +249,8 @@ static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identity,
BIO_printf(bio_c_out, "Received PSK identity hint '%s'\n", hint);
/* lookup PSK identity and PSK key based on the given identity hint here */
- ret = BIO_snprintf(identity, max_identity_len, "%s", psk_identity);
- if (ret < 0 || (unsigned int)ret > max_identity_len)
+ ret = snprintf(identity, maxlen, "%s", psk_identity);
+ if (ret == -1 || ret >= maxlen)
goto out_err;
if (c_debug)
BIO_printf(bio_c_out, "created identity '%s' len=%d\n", identity, ret);