From: Jouni Malinen Date: Wed, 8 Mar 2017 14:16:37 +0000 (+0200) Subject: RRM: Fix wpas_rrm_send_msr_report() loop handling X-Git-Tag: hostap_2_7~1490 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b696f791ac011a7d9bed73db11c16199b56aa2b1;p=thirdparty%2Fhostap.git RRM: Fix wpas_rrm_send_msr_report() loop handling The while (len) loop was updating the next pointer at the end even when len == 0, i.e., when the new next value won't be used. This could result in reading one octet beyond the end of the allocated response wpabuf. While the read value is not really used in practice, this is not correct behavior, so fix this by skipping the unnecessary next pointer update in len == 0 case. Signed-off-by: Jouni Malinen --- diff --git a/wpa_supplicant/rrm.c b/wpa_supplicant/rrm.c index 8ba372155..18d4907d8 100644 --- a/wpa_supplicant/rrm.c +++ b/wpa_supplicant/rrm.c @@ -409,7 +409,8 @@ static void wpas_rrm_send_msr_report(struct wpa_supplicant *wpa_s, pos = next; } - next += next[1] + 2; + if (len) + next += next[1] + 2; } #undef MPDU_REPORT_LEN }