Commit c790a6bd authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Greg Kroah-Hartman

ALSA: core: fix buffer overflow in snd_info_get_line()

commit ddc64b27 upstream.

snd_info_get_line() documents that its last parameter must be one
less than the buffer size, but this API design guarantees that
(literally) every caller gets it wrong.

Just change this parameter to have its obvious meaning.
Reported-by: default avatarTommi Rantala <tt.rantala@gmail.com>
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9486b8c7
......@@ -684,7 +684,7 @@ int snd_info_card_free(struct snd_card *card)
* snd_info_get_line - read one line from the procfs buffer
* @buffer: the procfs buffer
* @line: the buffer to store
* @len: the max. buffer size - 1
* @len: the max. buffer size
*
* Reads one line from the buffer and stores the string.
*
......@@ -704,7 +704,7 @@ int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len)
buffer->stop = 1;
if (c == '\n')
break;
if (len) {
if (len > 1) {
len--;
*line++ = c;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment