ALSA: hda_hwdep: Fix possible buffer overflow
authorAlexander Stein <alexander.stein@systec-electronic.com>
Tue, 1 Nov 2011 08:40:07 +0000 (09:40 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 1 Nov 2011 08:46:39 +0000 (09:46 +0100)
If a line in the firmware file is larger than the given buffer size (and
so the firmware file size), size is set to a value larger than the actual
buffer size. This results in an overflow in the buffer passed.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_hwdep.c

index 72e5885007ccfa39887389f644bd06fa1c77bcd2..7e7d0788ddcf69d611e3e0b3f421b8863ee1c9b7 100644 (file)
@@ -756,8 +756,6 @@ static int get_line_from_fw(char *buf, int size, struct firmware *fw)
        }
        if (!fw->size)
                return 0;
-       if (size < fw->size)
-               size = fw->size;
 
        for (len = 0; len < fw->size; len++) {
                if (!*p)