]> git.alsa-project.org Git - alsa-utils.git/commitdiff
speaker-test: fix segfault with more than 16 channels
authorGeoffrey D. Bennett <g@b4.vu>
Mon, 26 Jan 2026 17:22:15 +0000 (03:52 +1030)
committerJaroslav Kysela <perex@perex.cz>
Mon, 25 May 2026 09:40:47 +0000 (11:40 +0200)
get_channel_name() was accessing the channel_name array without bounds
checking. When using more than 16 channels without a channel map, it
would read past the end of the array and crash.

Closes: https://github.com/alsa-project/alsa-utils/pull/319
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
speaker-test/speaker-test.c

index d3fec2b3adc96214da81c8aa1ba47185b8533ff2..4bf90e3c635c72df228e35bad07fe3e35515f7a0 100644 (file)
@@ -285,7 +285,9 @@ static const char *get_channel_name(int chn)
     return name ? name : "Unknown";
   }
 #endif
-  return gettext(channel_name[chn]);
+  if (chn < MAX_CHANNELS)
+    return gettext(channel_name[chn]);
+  return "Unknown";
 }
 
 static const int       supported_formats[] = {