]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
tls_common.c: Handle inner content type properly on Big Endian
authorTomas Mraz <tomas@openssl.org>
Sat, 20 Sep 2025 14:45:50 +0000 (16:45 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 23 Sep 2025 14:37:35 +0000 (16:37 +0200)
When passing the inner content type to msg_callback,
the lowest byte of rec->type needs to be passed instead
of directly passing the rec->type otherwise the value is
incorrect on Big Endian platforms.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28627)

ssl/record/methods/tls_common.c

index f69dd0b05550e69e2c94db2d99de5d465e76ac32..6ee265021c51c3b68aac88321ed84c4ba9fa2238 100644 (file)
@@ -1093,9 +1093,12 @@ int tls13_common_post_process_record(OSSL_RECORD_LAYER *rl, TLS_RL_RECORD *rec)
         return 0;
     }
 
-    if (rl->msg_callback != NULL)
-        rl->msg_callback(0, rl->version, SSL3_RT_INNER_CONTENT_TYPE, &rec->type,
-                        1, rl->cbarg);
+    if (rl->msg_callback != NULL) {
+        unsigned char ctype = (unsigned char)rec->type;
+
+        rl->msg_callback(0, rl->version, SSL3_RT_INNER_CONTENT_TYPE, &ctype,
+                         1, rl->cbarg);
+    }
 
     /*
      * TLSv1.3 alert and handshake records are required to be non-zero in