aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2019-04-16 23:21:20 (GMT)
committerJouni Malinen <j@w1.fi>2019-04-17 10:24:37 (GMT)
commitd2d1a324ce937628e4d9d9999fe113819b7d4478 (patch)
tree47102e59a183bec622e11dac43256312c1fdacb0
parenta143bdc0d1089bbbcbf730608848070c09a2ea25 (diff)
downloadhostap-d2d1a324ce937628e4d9d9999fe113819b7d4478.zip
hostap-d2d1a324ce937628e4d9d9999fe113819b7d4478.tar.gz
hostap-d2d1a324ce937628e4d9d9999fe113819b7d4478.tar.bz2
EAP-pwd peer: Fix reassembly buffer handling
Unexpected fragment might result in data->inbuf not being allocated before processing and that could have resulted in NULL pointer dereference. Fix that by explicitly checking for data->inbuf to be available before using it. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
-rw-r--r--src/eap_peer/eap_pwd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
index 46894a5..76fcad4 100644
--- a/src/eap_peer/eap_pwd.c
+++ b/src/eap_peer/eap_pwd.c
@@ -932,6 +932,13 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
* buffer and ACK the fragment
*/
if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
+ if (!data->inbuf) {
+ wpa_printf(MSG_DEBUG,
+ "EAP-pwd: No buffer for reassembly");
+ ret->methodState = METHOD_DONE;
+ ret->decision = DECISION_FAIL;
+ return NULL;
+ }
data->in_frag_pos += len;
if (data->in_frag_pos > wpabuf_size(data->inbuf)) {
wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack "
@@ -958,7 +965,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
/*
* we're buffering and this is the last fragment
*/
- if (data->in_frag_pos) {
+ if (data->in_frag_pos && data->inbuf) {
wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
(int) len);
pos = wpabuf_head_u8(data->inbuf);