]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
TLS: Fix block cipher padding validation
authorJouni Malinen <j@w1.fi>
Sun, 13 Nov 2011 08:42:06 +0000 (10:42 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 13 Nov 2011 08:42:06 +0000 (10:42 +0200)
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>

src/tls/tlsv1_record.c

index 1b1b4668cc43802b21be88bd0e03ca277055e9ae..dd022a58ecf1261d993813ee71cf7e307081d866 100644 (file)
@@ -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;
                                }