]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/commitdiff
Check return value in tls_send_invalid_cert_message().
authorSimon Ruderich <simon@ruderich.org>
Sat, 17 Aug 2013 14:10:31 +0000 (16:10 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sat, 17 Aug 2013 14:11:05 +0000 (16:11 +0200)
src/connection.c

index 07885dfdeed9337468593376c381c9a57411580f..15eb321d811965d4f0b1a71c72659fb500a3d5ea 100644 (file)
@@ -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. */
 }