summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2014-08-21 20:55:21 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-05 14:54:07 -0700
commitb2a014bc3d20aab7789c92c7549b98b9e0c34383 (patch)
treef4945c813951e0ac82b9b88d5d8e58a01b5f985f /sound
parent73ab9689158dd27735252037e036cd908a0db65a (diff)
downloadlinux-3.10-b2a014bc3d20aab7789c92c7549b98b9e0c34383.tar.gz
linux-3.10-b2a014bc3d20aab7789c92c7549b98b9e0c34383.tar.bz2
linux-3.10-b2a014bc3d20aab7789c92c7549b98b9e0c34383.zip
ALSA: core: fix buffer overflow in snd_info_get_line()
commit ddc64b278a4dda052390b3de1b551e59acdff105 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: Tommi Rantala <tt.rantala@gmail.com> Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/info.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/core/info.c b/sound/core/info.c
index e79baa11b60..08070e1eefe 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -679,7 +679,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.
*
@@ -699,7 +699,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;
}