Browse Source

TLS: Fix block cipher padding validation

The padding validation was done on the last padding-length octets in the
buffer which misses the first padding octet (the last octet is the
padding length). Fix the starting offset for the comparison loop to get
the first octet verified. [Bug 420]

Signed-hostap: Jouni Malinen <j@w1.fi>
Jouni Malinen 13 years ago
parent
commit
613522a40a
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/tls/tlsv1_record.c

+ 3 - 3
src/tls/tlsv1_record.c

@@ -406,13 +406,13 @@ int tlsv1_record_receive(struct tlsv1_record_layer *rl,
 				force_mac_error = 1;
 				goto check_mac;
 			}
-			for (i = plen - padlen; i < plen; i++) {
+			for (i = plen - padlen - 1; i < plen - 1; i++) {
 				if (out_data[i] != padlen) {
 					wpa_hexdump(MSG_DEBUG,
 						    "TLSv1: Invalid pad in "
 						    "received record",
-						    out_data + plen - padlen,
-						    padlen);
+						    out_data + plen - padlen -
+						    1, padlen + 1);
 					force_mac_error = 1;
 					goto check_mac;
 				}