diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 1613fd644784..968b943af289 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -5614,8 +5614,18 @@ static void lim_process_update_add_ies(tpAniSirGlobal mac_ctx, if (update_ie->append) { /* * In case of append, allocate new memory - * with combined length + * with combined length. + * Multiple back to back append commands + * can lead to a huge length.So, check + * for the validity of the length. */ + if (addn_ie->probeRespDataLen > + (USHRT_MAX - update_ie->ieBufferlength)) { + pe_err("IE Length overflow, curr:%d, new:%d", + addn_ie->probeRespDataLen, + update_ie->ieBufferlength); + goto end; + } new_length = update_ie->ieBufferlength + addn_ie->probeRespDataLen; new_ptr = qdf_mem_malloc(new_length);