Skip to contentSkip to conversation

ALSA: Read buffer overflow

PATCH In review Roel Kluin 2 participants 2 messages Aug 2, 2009 – Aug 3, 2009 Sound

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 ALSA: Read buffer overflow

Check whether index is within bounds before testing the element.

---

sound/pci/hda/patch_realtek.c +1 -1
index 8c8b273..45e0ee0 100644
@@ -559,7 +559,7 @@ static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
 
 	/* Find enumerated value for current pinctl setting */
 	i = alc_pin_mode_min(dir);
-	while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
+	while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
 		i++;
 	*valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
 	return 0;
#1 lore raw

At Sun, 02 Aug 2009 13:30:45 +0200,

Quoted 4 lines · Roel Kluin

Check whether index is within bounds before testing the element.

Applied now. Thanks.

Takashi

Quoted 15 lines

---

sound/pci/hda/patch_realtek.c +1 -1
index 8c8b273..45e0ee0 100644
@@ -559,7 +559,7 @@ static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
 
 	/* Find enumerated value for current pinctl setting */
 	i = alc_pin_mode_min(dir);
-	while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
+	while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
 		i++;
 	*valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
 	return 0;