Skip to content

Commit eea8723

Browse files
author
Adam Langley
committedAug 8, 2016
Fix test of first of 255 CBC padding bytes.
Thanks to Peter Gijsels for pointing out that if a CBC record has 255 bytes of padding, the first was not being checked. (This is an import of change 80842bdb from BoringSSL.) Reviewed-by: Emilia Käsper <[email protected]> Reviewed-by: Rich Salz <[email protected]> (Merged from openssl#1431)
1 parent 358558e commit eea8723

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎ssl/record/ssl3_record.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1149,9 +1149,9 @@ int tls1_cbc_remove_padding(const SSL *s,
11491149
* maximum amount of padding possible. (Again, the length of the record
11501150
* is public information so we can use it.)
11511151
*/
1152-
to_check = 255; /* maximum amount of padding. */
1153-
if (to_check > rec->length - 1)
1154-
to_check = rec->length - 1;
1152+
to_check = 256; /* maximum amount of padding, inc length byte. */
1153+
if (to_check > rec->length)
1154+
to_check = rec->length;
11551155

11561156
for (i = 0; i < to_check; i++) {
11571157
unsigned char mask = constant_time_ge_8(padding_length, i);

0 commit comments

Comments
 (0)