From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754530AbcAHKNa (ORCPT ); Fri, 8 Jan 2016 05:13:30 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:37100 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754474AbcAHKN1 (ORCPT ); Fri, 8 Jan 2016 05:13:27 -0500 Date: Fri, 8 Jan 2016 10:13:23 +0000 From: Matt Fleming To: Insu Yun Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, taesoo@gatech.edu, yeongjin.jang@gatech.edu, insu@gatech.edu, changwoo@gatech.edu, Tony Luck Subject: Re: [PATCH] efi: fix out-of-bounds null overwrite vulnerability Message-ID: <20160108101323.GA2532@codeblueprint.co.uk> References: <1452193530-76672-1-git-send-email-wuninsu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1452193530-76672-1-git-send-email-wuninsu@gmail.com> User-Agent: Mutt/1.5.24+41 (02bc14ed1569) (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 07 Jan, at 02:05:30PM, Insu Yun wrote: > snprintf's return value is not bound by size value. > (https://www.kernel.org/doc/htmldocs/kernel-api/API-snprintf.html) > if printed value is larger than buffer size, it can overwrite > null byte in out-of-bounds buffer. But this function doesn't use snprintf(), it uses scnprintf() which returns the number of characters written into buf and, because scnprintf() largely follows vnsprintf(), it will never write more than 'size' bytes into the buffer. > Signed-off-by: Insu Yun > --- > drivers/firmware/efi/cper.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c > index d425374..77aa75f 100644 > --- a/drivers/firmware/efi/cper.c > +++ b/drivers/firmware/efi/cper.c > @@ -267,7 +267,6 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg) > "DIMM location: not present. DMI handle: 0x%.4x ", > mem->mem_dev_handle); > > - msg[n] = '\0'; > return n; > } > Calling this a vulnerability is a little extreme. These fields come from firmware and if you can't trust the firmware you've got bigger issues. I'm not even sure this is a bug. Tony?