From: Simon Ruderich Date: Sat, 17 Aug 2013 14:10:31 +0000 (+0200) Subject: Check return value in tls_send_invalid_cert_message(). X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=83965c106ac6a33d1c4248b7ccae93de438f7727;p=tlsproxy%2Ftlsproxy.git Check return value in tls_send_invalid_cert_message(). --- diff --git a/src/connection.c b/src/connection.c index 07885df..15eb321 100644 --- a/src/connection.c +++ b/src/connection.c @@ -617,6 +617,7 @@ static void tls_send_invalid_cert_message(gnutls_session_t session) { const char msg[] = "Server certificate validation failed, check logs."; int result; + ssize_t size_written; char buffer[sizeof(HTTP_RESPONSE_FORMAT) + 3 * sizeof(error) + sizeof(msg)]; @@ -624,7 +625,13 @@ static void tls_send_invalid_cert_message(gnutls_session_t session) { error, "", error, error, msg); assert(result > 0 && (size_t)result < sizeof(buffer)); - gnutls_record_send(session, buffer, strlen(buffer)); + size_written = gnutls_record_send(session, buffer, strlen(buffer)); + if (size_written < 0) { + LOG(WARNING, "tls_send_invalid_cert_message(): " + "gnutls_record_send(): %s", + gnutls_strerror((int)size_written)); + } + /* Just an error message, no need to check if everything was written. */ }