Fixed potential NULL pointer dereference if memory allocation fails
This commit is contained in:
parent
815c5e1435
commit
7cdeb81e1f
1 changed files with 6 additions and 0 deletions
|
@ -114,6 +114,10 @@ struct wpabuf * eap_server_tls_build_msg(struct eap_ssl_data *data,
|
||||||
size_t send_len, plen;
|
size_t send_len, plen;
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "SSL: Generating Request");
|
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;
|
flags = version;
|
||||||
send_len = wpabuf_len(data->out_buf) - data->out_used;
|
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 */
|
/* reserve some extra room for encryption overhead */
|
||||||
buf_len = plain_len + 200;
|
buf_len = plain_len + 200;
|
||||||
buf = wpabuf_alloc(buf_len);
|
buf = wpabuf_alloc(buf_len);
|
||||||
|
if (buf == NULL)
|
||||||
|
return NULL;
|
||||||
res = tls_connection_encrypt(sm->ssl_ctx, data->conn,
|
res = tls_connection_encrypt(sm->ssl_ctx, data->conn,
|
||||||
plain, plain_len, wpabuf_put(buf, 0),
|
plain, plain_len, wpabuf_put(buf, 0),
|
||||||
buf_len);
|
buf_len);
|
||||||
|
|
Loading…
Reference in a new issue