From patchwork Fri Sep 27 19:34:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Shumilin X-Patchwork-Id: 13814528 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1BA29CDD1D2 for ; Fri, 27 Sep 2024 19:42:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9727310ECFC; Fri, 27 Sep 2024 19:42:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=nppct.ru header.i=@nppct.ru header.b="EXJyxVaa"; dkim-atps=neutral X-Greylist: delayed 484 seconds by postgrey-1.36 at gabe; Fri, 27 Sep 2024 19:42:41 UTC Received: from mail.nppct.ru (mail.nppct.ru [195.133.245.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id ABFBE10ECFC for ; Fri, 27 Sep 2024 19:42:41 +0000 (UTC) Received: from mail.nppct.ru (localhost [127.0.0.1]) by mail.nppct.ru (Postfix) with ESMTP id 01B621C2496 for ; Fri, 27 Sep 2024 22:34:32 +0300 (MSK) Authentication-Results: mail.nppct.ru (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=nppct.ru DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nppct.ru; h= content-transfer-encoding:content-type:content-type:mime-version :x-mailer:message-id:date:date:subject:subject:to:from:from; s= dkim; t=1727465671; x=1728329672; bh=69YOQWzSC2bqH1BrOBpaojGYM3H qDuEomSdv5BxvE4Q=; b=EXJyxVaa8hT+LSevKsqFES6UR3Iul28RR9B58KsWRQe Y8V/+gx60+uPo991G9l+6CO+dofWm498GxEn4AhHqwnSclqlHn0HZ9P09Hj8vJ27 LbXxlOvjimTxrNFmDxCzUzcZEVZjaFFfwIoe5RBEFMudFaTDJWaO+9F1t/UnzULo = X-Virus-Scanned: Debian amavisd-new at mail.nppct.ru Received: from mail.nppct.ru ([127.0.0.1]) by mail.nppct.ru (mail.nppct.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id v3w7yVr7-uBz for ; Fri, 27 Sep 2024 22:34:31 +0300 (MSK) Received: from localhost.localdomain (mail.dev-ai-melanoma.ru [185.130.227.204]) by mail.nppct.ru (Postfix) with ESMTPSA id EA7D81C0604; Fri, 27 Sep 2024 22:34:29 +0300 (MSK) From: Andrey Shumilin To: Thomas Winischhofer Cc: Andrey Shumilin , Bartlomiej Zolnierkiewicz , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, khoroshilov@ispras.ru, ykarpov@ispras.ru, vmerzlyakov@ispras.ru, vefanov@ispras.ru Subject: [PATCH 2/2] sis_main: Fix strbuf array overflow Date: Fri, 27 Sep 2024 22:34:24 +0300 Message-Id: <20240927193424.3934247-1-shum.sdl@nppct.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The values of the variables xres and yres are placed in strbuf. These variables are obtained from strbuf1. The strbuf1 array contains digit characters and a space if the array contains non-digit characters. Then, when executing sprintf(strbuf, "%ux%ux8", xres, yres); more than 16 bytes will be written to strbuf. It is suggested to increase the size of the strbuf array to 24. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Andrey Shumilin --- drivers/video/fbdev/sis/sis_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c index 03c736f6f3d0..e907fde96ff4 100644 --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -183,7 +183,7 @@ static void sisfb_search_mode(char *name, bool quiet) { unsigned int j = 0, xres = 0, yres = 0, depth = 0, rate = 0; int i = 0; - char strbuf[16], strbuf1[20]; + char strbuf[24], strbuf1[20]; char *nameptr = name; /* We don't know the hardware specs yet and there is no ivideo */