Skip to content

Commit

Permalink
ALSA: hda: fix out-of-bound hdmi_eld.sad[] write
Browse files Browse the repository at this point in the history
e->sad[] is declared with size ELD_MAX_SAD=16, but the guard
allows range 0-31.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Roel Kluin authored and Takashi Iwai committed Jul 29, 2009
1 parent 626f5ce commit 78735cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/pci/hda/hda_eld.c
Original file line number Diff line number Diff line change
@@ -508,7 +508,7 @@ static void hdmi_write_eld_info(struct snd_info_entry *entry,
char name[64];
char *sname;
long long val;
int n;
unsigned int n;

while (!snd_info_get_line(buffer, line, sizeof(line))) {
if (sscanf(line, "%s %llx", name, &val) != 2)
@@ -539,7 +539,7 @@ static void hdmi_write_eld_info(struct snd_info_entry *entry,
sname++;
n = 10 * n + name[4] - '0';
}
if (n < 0 || n > 31) /* double the CEA limit */
if (n >= ELD_MAX_SAD)
continue;
if (!strcmp(sname, "_coding_type"))
e->sad[n].format = val;

0 comments on commit 78735cf

Please sign in to comment.