From 83965c106ac6a33d1c4248b7ccae93de438f7727 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 17 Aug 2013 16:10:31 +0200 Subject: [PATCH] Check return value in tls_send_invalid_cert_message(). --- src/connection.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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. */ } -- 2.45.2