Browse Source

eap_server: Avoid NULL pointer dereference in eap_fast_encrypt_phase2()

If TLS encryption fails, encr may be NULL and that would have resulted
in NULL pointer dereference..

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Haim Dreyfuss 10 years ago
parent
commit
b760e64276
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/eap_server/eap_server_fast.c

+ 3 - 0
src/eap_server/eap_server_fast.c

@@ -819,6 +819,9 @@ static int eap_fast_encrypt_phase2(struct eap_sm *sm,
 	encr = eap_server_tls_encrypt(sm, &data->ssl, plain);
 	wpabuf_free(plain);
 
+	if (!encr)
+		return -1;
+
 	if (data->ssl.tls_out && piggyback) {
 		wpa_printf(MSG_DEBUG, "EAP-FAST: Piggyback Phase 2 data "
 			   "(len=%d) with last Phase 1 Message (len=%d "