summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2014-04-14 18:53:15 +0000
committerBob Beck <beck@cvs.openbsd.org>2014-04-14 18:53:15 +0000
commitb45557df7deeea9767b15898ae6219fc122d9a4b (patch)
tree7f7930bb684ceb961ff978e1f7124e48fa26464f /lib
parent18604be7334b9e04f947b868c48a75d2d19838a1 (diff)
Flense all use of BIO_snprintf from ssl source - use the real one instead,
and allow for the normal posix mandated return values instead of the nonstandard one from BIO_snprintf. ok miod@
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/d1_pkt.c2
-rw-r--r--lib/libssl/ssl_ciph.c11
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/libssl/d1_pkt.c b/lib/libssl/d1_pkt.c
index 830dc2d2d02..cb5f2c3199c 100644
--- a/lib/libssl/d1_pkt.c
+++ b/lib/libssl/d1_pkt.c
@@ -1117,7 +1117,7 @@ start:
s->rwstate = SSL_NOTHING;
s->s3->fatal_alert = alert_descr;
SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr);
- BIO_snprintf(tmp, sizeof tmp, "%d", alert_descr);
+ (void) snprintf(tmp,sizeof tmp,"%d",alert_descr);
ERR_add_error_data(2, "SSL alert number ", tmp);
s->shutdown|=SSL_RECEIVED_SHUTDOWN;
SSL_CTX_remove_session(s->ctx, s->session);
diff --git a/lib/libssl/ssl_ciph.c b/lib/libssl/ssl_ciph.c
index f37c70cf915..0e24e0a5c69 100644
--- a/lib/libssl/ssl_ciph.c
+++ b/lib/libssl/ssl_ciph.c
@@ -1499,7 +1499,7 @@ const char *rule_str)
char
*SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
{
- int is_export, pkl, kl;
+ int is_export, pkl, kl, l;
const char *ver, *exp_str;
const char *kx, *au, *enc, *mac;
unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, alg2;
@@ -1672,11 +1672,14 @@ char
return("Buffer too small");
#ifdef KSSL_DEBUG
- BIO_snprintf(buf, len, format, cipher->name, ver, kx, au, enc, mac, exp_str, alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl);
+ l = snprintf(buf, len, format, cipher->name, ver, kx, au, enc, mac, exp_str, alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl);
#else
- BIO_snprintf(buf, len, format, cipher->name, ver, kx, au, enc, mac, exp_str);
+ l = snprintf(buf, len, format, cipher->name, ver, kx, au, enc, mac, exp_str);
#endif /* KSSL_DEBUG */
- return (buf);
+ if (l >= len || l == -1)
+ return("Buffer too small");
+ else
+ return (buf);
}
char