aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_server/eap_tls_common.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-06-05 17:44:30 (GMT)
committerJouni Malinen <j@w1.fi>2008-06-05 17:44:30 (GMT)
commit7cdeb81e1fc25b96454ee9a66ef1f30aa57b7a40 (patch)
treee3e0444d3ab6010dbe697bb1e72d0d6ae5892b9f /src/eap_server/eap_tls_common.c
parent815c5e1435fca7049fda7bd4b2dab2bdbc855062 (diff)
downloadhostap-06-7cdeb81e1fc25b96454ee9a66ef1f30aa57b7a40.zip
hostap-06-7cdeb81e1fc25b96454ee9a66ef1f30aa57b7a40.tar.gz
hostap-06-7cdeb81e1fc25b96454ee9a66ef1f30aa57b7a40.tar.bz2
Fixed potential NULL pointer dereference if memory allocation fails
Diffstat (limited to 'src/eap_server/eap_tls_common.c')
-rw-r--r--src/eap_server/eap_tls_common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/eap_server/eap_tls_common.c b/src/eap_server/eap_tls_common.c
index 4f91ee7..befc1bf 100644
--- a/src/eap_server/eap_tls_common.c
+++ b/src/eap_server/eap_tls_common.c
@@ -114,6 +114,10 @@ struct wpabuf * eap_server_tls_build_msg(struct eap_ssl_data *data,
size_t send_len, plen;
wpa_printf(MSG_DEBUG, "SSL: Generating Request");
+ if (data->out_buf == NULL) {
+ wpa_printf(MSG_ERROR, "SSL: out_buf NULL in %s", __func__);
+ return NULL;
+ }
flags = version;
send_len = wpabuf_len(data->out_buf) - data->out_used;
@@ -342,6 +346,8 @@ struct wpabuf * eap_server_tls_encrypt(struct eap_sm *sm,
/* reserve some extra room for encryption overhead */
buf_len = plain_len + 200;
buf = wpabuf_alloc(buf_len);
+ if (buf == NULL)
+ return NULL;
res = tls_connection_encrypt(sm->ssl_ctx, data->conn,
plain, plain_len, wpabuf_put(buf, 0),
buf_len);