From: Amit Khatri <amit.khatri@xxxxxxxxxxx> Date: Thu, 24 Aug 2017 00:16:26 -0700 Subject: [PATCH] iw: Null check before accessing n_mcs variable If all cases will fail n_mcs variable fail to get any assignement and remain NULL. so better to check NULL before dereference. Signed-off-by: Amit Khatri <amit.khatri@xxxxxxxxxxx> --- bitrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bitrate.c b/bitrate.c index 4a026a4..3e58337 100644 --- a/bitrate.c +++ b/bitrate.c @@ -185,7 +185,8 @@ static int handle_bitrates(struct nl80211_state *state, return 1; if (tmpl < 0 || tmpl > 255) return 1; - mcs[(*n_mcs)++] = tmpl; + if(n_mcs!=NULL) + mcs[(*n_mcs)++] = tmpl; break; case S_VHT: if (*vht_argc >= VHT_ARGC_MAX) -- 1.7.9.5