Skip to content

Commit

Permalink
Add more error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelortmann committed Jun 10, 2024
1 parent 4776a10 commit 0b41275
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,12 @@ static char *ssl_printname(X509_NAME *name)

/* X509_NAME_oneline() is easier and shorter, but is deprecated and
the manual discourages it's usage, so let's not be lazy ;) */
if (!bio) {
debug0("TLS: ssl_printname(): BIO_new(): error");
buf = nmalloc(1);
*buf = 0;
return buf;
}
if (X509_NAME_print_ex(bio, name, 0, XN_FLAG_ONELINE & ~XN_FLAG_SPC_EQ)) {
len = BIO_get_mem_data(bio, &data);
if (len > 0) {
Expand Down Expand Up @@ -712,7 +718,7 @@ int ssl_verify(int ok, X509_STORE_CTX *ctx)
!(data->verify & TLS_VERIFYFROM)) ||
((err == X509_V_ERR_CERT_HAS_EXPIRED) &&
!(data->verify & TLS_VERIFYTO))) {
debug1("TLS: peer certificate warning: %s",
putlog(data->loglevel, "*", "TLS: peer certificate warning: %s",
X509_verify_cert_error_string(err));
ok = 1;
}
Expand Down

0 comments on commit 0b41275

Please sign in to comment.