From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932900Ab1JZNUo (ORCPT ); Wed, 26 Oct 2011 09:20:44 -0400 Received: from cantor2.suse.de ([195.135.220.15]:39900 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754926Ab1JZNUn (ORCPT ); Wed, 26 Oct 2011 09:20:43 -0400 Date: Wed, 26 Oct 2011 15:20:42 +0200 Message-ID: From: Takashi Iwai To: Alexander Stein Cc: Jaroslav Kysela , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hda_hwdep: Fix possible buffer overflow In-Reply-To: <201110261515.25189.alexander.stein@systec-electronic.com> References: <1319615292-27396-1-git-send-email-alexander.stein@systec-electronic.com> <201110261515.25189.alexander.stein@systec-electronic.com> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Wed, 26 Oct 2011 15:15:24 +0200, Alexander Stein wrote: > > Hello, > > On Wednesday 26 October 2011 14:58:43 Takashi Iwai wrote: > > At Wed, 26 Oct 2011 09:48:12 +0200, > > > > Alexander Stein wrote: > > > 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. > > > Fix this by copying only up to 127 chars per line. > > > > Actually this check should have been > > > > if (size > fw->size) > > size = fw->size; > > > > Otherwise it doesn't make sense. > > If the change is OK, could you resend the patch with it? > > IMO this check isn't even needed. This case should be catched by this check > > for (len = 0; len < fw->size; len++) { > > already. > Opinions? Right, it's superfluous. Let's get rid of it. Takashi