Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2dce679 authored by Aravind Kumar's avatar Aravind Kumar Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm8x16-wcd: prevent out of bounds access



Hardcoding the third argument in strnstr function
is resulting in out of bounds access. Set the third argument
to sizeof the character string passed as the first argument
to prevent out of bounds access.

CRs-Fixed: 832915
Change-Id: I61be88701340e271fd866e0e1801722dbe7d63ac
Signed-off-by: default avatarAravind Kumar <akumark@codeaurora.org>
parent 65d73670
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -3468,7 +3468,7 @@ static int msm8x16_wcd_codec_enable_micbias(struct snd_soc_dapm_widget *w,
			snd_soc_update_bits(codec, micb_int_reg, 0x08, 0x08);
			msm8x16_notifier_call(codec,
					WCD_EVENT_POST_MICBIAS_2_ON);
		} else if (strnstr(w->name, internal3_text, 30)) {
		} else if (strnstr(w->name, internal3_text, strlen(w->name))) {
			snd_soc_update_bits(codec, micb_int_reg, 0x01, 0x01);
		} else if (strnstr(w->name, external2_text, strlen(w->name))) {
			msm8x16_notifier_call(codec,
@@ -3481,7 +3481,7 @@ static int msm8x16_wcd_codec_enable_micbias(struct snd_soc_dapm_widget *w,
		} else if (strnstr(w->name, internal2_text, strlen(w->name))) {
			msm8x16_notifier_call(codec,
					WCD_EVENT_POST_MICBIAS_2_OFF);
		} else if (strnstr(w->name, internal3_text, 30)) {
		} else if (strnstr(w->name, internal3_text, strlen(w->name))) {
			snd_soc_update_bits(codec, micb_int_reg, 0x2, 0x0);
		} else if (strnstr(w->name, external2_text, strlen(w->name))) {
			/*