Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp360475pxb; Wed, 14 Apr 2021 17:49:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzM3qzWBOdKtdwj002xP1sMMFBrbmJUz4ujFMVDEygxJDfLYX9dJ/OWE6n6wqcD30KBhWDn X-Received: by 2002:a17:902:e851:b029:eb:1fd0:fa8e with SMTP id t17-20020a170902e851b02900eb1fd0fa8emr1067775plg.38.1618447793968; Wed, 14 Apr 2021 17:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618447793; cv=none; d=google.com; s=arc-20160816; b=zhSVjLAmpvaQXsgfLkX1jFJjuDFcQ7QSk56osqVCMM9mioM0XoGTse4xkqbXAGym7k q/gz7GKeMtc+Ykcw1ULhQCjQ1kgllTgt1BQ7pQA/53ou9Yfu68opMhYUmAasnybZhfFA 4sRMTzGXieSCAFmUhj+LPVg2gyEouHuCmS2nnhrT+usl5rP6t7CXImMfPF7U4yVRy/Wr 7rdBRScIvffaL17LpL7+iTQLfIv3/Gy2JCl+CMETGhKcUXENJ0QRTZwcwZiU/0I+os9K t/R35pJbXB4kOQ56nqVcUdrWXsMn9Mxh9av6hSP7uDcBxBK7FqVRUy6Dr6hEDjwMtPmG 6XNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=e5OTX/WIQkSK+Nv4NGPJ8vH0KUzey1Vo9qPImqtVRNk=; b=z1HAtqo7SnTe+t8vH3HA31dLfsuqG6usak1CYa9AdzHPOwUPIWMgyi+RbfdPE4d/2X 0Rs/opfjX++H5JZo5VLdyWPAEEPStjuQ/Kg0HngrAnB0Ut/7/QF1QWcATvZZ4quKd7rM xDbG7ImgP3vQaBVfKvsC64+mkbaM+o8P5GmO0gATcJpNFJ5Z7OpRh42RER2TGsq2PJUC e5fhRuxRAiBzCbvhbLh8XkZbgJMGOBicS2upoe8w0QSdHH2pgccZ++uN8n6JyNLiUtmB 2TKzfgwoCl7RGErBWFGwnIkej7EZG55KUgK6v9u1/8QBZEaDt8f8z3Y5EFY/IB1yJ17y f4XQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 62si1325708plb.203.2021.04.14.17.49.42; Wed, 14 Apr 2021 17:49:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234824AbhDNWjh (ORCPT + 99 others); Wed, 14 Apr 2021 18:39:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234218AbhDNWjf (ORCPT ); Wed, 14 Apr 2021 18:39:35 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3252AC061574; Wed, 14 Apr 2021 15:39:13 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 9449592009E; Thu, 15 Apr 2021 00:39:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 90EC192009C; Thu, 15 Apr 2021 00:39:12 +0200 (CEST) Date: Thu, 15 Apr 2021 00:39:12 +0200 (CEST) From: "Maciej W. Rozycki" To: Khalid Aziz , "James E.J. Bottomley" , "Martin K. Petersen" cc: Christoph Hellwig , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] scsi: BusLogic: Avoid unbounded `vsprintf' use In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Existing `blogic_msg' invocations do not appear to overrun its internal buffer of a fixed length of 100, which would cause stack corruption, but it's easy to miss with possible further updates and a fix is cheap in performance terms, so limit the output produced into the buffer by using `vsnprintf' rather than `vsprintf'. Signed-off-by: Maciej W. Rozycki --- drivers/scsi/BusLogic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) linux-buslogic-vsnprintf.diff Index: linux-macro-ide/drivers/scsi/BusLogic.c =================================================================== --- linux-macro-ide.orig/drivers/scsi/BusLogic.c +++ linux-macro-ide/drivers/scsi/BusLogic.c @@ -3588,7 +3588,7 @@ static void blogic_msg(enum blogic_msgle int len = 0; va_start(args, adapter); - len = vsprintf(buf, fmt, args); + len = vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); if (msglevel == BLOGIC_ANNOUNCE_LEVEL) { static int msglines = 0;