Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp2959310pxv; Sun, 18 Jul 2021 06:41:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdYicXxzsnezpccKAjxig1kTinD96+FhcawrrbzvormHjXCiGnMxP2kTpHXww/SOtkYvrD X-Received: by 2002:a17:906:2813:: with SMTP id r19mr22416394ejc.150.1626615684094; Sun, 18 Jul 2021 06:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626615684; cv=none; d=google.com; s=arc-20160816; b=A1N9y1NB2nLxJ4BKWEjn6yXjjv9FNRZx9WMxamr5ldrgW55T1bghij8bRdoufLUFs6 h80Roo8js0+NuicyUV2CB5wCFA677UB1+ZnqoKMVVRoipD/7w5ZbME6CV2k/6ESzdrtD c16eUTrW63aplb3QoEO4ql8sCXbnH9zyjpBHu7Rq2yAg9oqASepove+WGTJzO70mCQ5J IJor3wtU6fb9WpkSjve9O7gJjECB4wpD1+/FNH+iyO3ovF/UVof4FlkDBlBJOKszJ2GG XtxB29VHT1HVvqsnwNEtHMHY3FB0ra48zXNQcNqfvS/n2PkqwxFndoDB85t24qA5rn4Z WMLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=7Z0jqewL3md0HCo8MOvBbB3mTOeKN2UsQo2ufGRUmbE=; b=tuSTWLxSXBW6wPJrSCCZhNjIdKbzExl3Wvwhof4cNCcAzzBUSkCzFSygjafgOY/9YF Ol8dj07HzbJbO2YJtvBlm307AtiCpwyL0JaZKggvLGX8LOZXvq+ST4jS1/rRX9Ty/zYk o+RFlQ2b7Vq53xShB6v3S20Z0T+DCNJRbwPWNoN07ImGSG0EbjmdOXDRVbnjOg2gLpSz kErVzG+juqOAbE2Xjy1vr2jJyXlb1veBMFO9lG5nsoUrPVG/Tu6RFqRfnIgfjM3RODvU NQv5oTRRwYIxU7dkAz/jS5Baj3s3rG4dMuPB9c2QTMfqR/0Lf4zqhNk7iPzkb0A9b/tY GggQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=XMibZM4e; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk13si5121346ejb.97.2021.07.18.06.41.00; Sun, 18 Jul 2021 06:41:24 -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; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=XMibZM4e; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233900AbhGRNnE (ORCPT + 99 others); Sun, 18 Jul 2021 09:43:04 -0400 Received: from mout.gmx.net ([212.227.17.20]:56411 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233888AbhGRNnD (ORCPT ); Sun, 18 Jul 2021 09:43:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1626615586; bh=1HpwNTaa7/EOz5SUy/Y+rxrxigaB7TM0uOC1wehYCrg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=XMibZM4erFJb4DEiqrUJM6aUE++xgTCwLSt9gbtnCFTXlapvMb6C/X/Ej9DcWFBWE UPffHDxauTm2chsRSrjtJAeQd1bzRMvKuTzl4b3bWoq62dtDG88/TQS1eWSydXKe1v YKeY4TFTUlnG3zmZ4PY67jSASp5y2KOQ3OKbJSJE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([83.52.228.41]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MpDJX-1lKkFJ0T5L-00qhpO; Sun, 18 Jul 2021 15:39:46 +0200 From: Len Baker To: Greg Kroah-Hartman Cc: Len Baker , Andy Shevchenko , Phil Reid , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] staging/fbtft: Remove all strcpy() uses Date: Sun, 18 Jul 2021 15:39:20 +0200 Message-Id: <20210718133920.15825-1-len.baker@gmx.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:HvTzj7KWNq6lSz5rqYyCxz1ImlYgklH3XUyeJLH414jVQCNGtlD H7cs5ERBdJ56v8O/OP3sv+soRp7147NkxxBubzDV+FcZ2KAi3NKUAetOG6G4RR3aaxIKG7r XTdfgl9+Amv2+X0EiqIlaozKA1rZwqSvHbGpNrBUd+BVU1/vIfNFjwv+jYxVxJyVr9+lODZ FF/eigpKaZGpE735rCNJA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ErRWAeYtbLk=:FXoDg8bzIG7LnbErPnu/F4 Ebd61X57ICWz1bIIviyeV7DXSv4+28BdSm5JY1EElzcEaA79ja+EVZiraGLGEaH2GOwvGNlTu AjATrZCxr8eDXFxPW9Jw+DjvE44mZTM3JUomg45LsVUk/Q+NUCff4F2GtDRfXsEKcDPeEQE8O BFF7Vabl+TOWoxO9JhzQw1CC9gHo3JNbxFZfZNtozDHnqtNW6gb/JGruFSfoQSsn4dHYjbNuL QeconA+Rg4pN6CgN2NMNluaX9vdLhWrhXc3KrCoc2ct7w01ggODgWXX0O6ae6H3ZEgR/bSir/ OdSx0OArvBsQ7TYLmp6+i8Y5DGVtMUYf8iQ5P3Cui/F4ipIPX09g0rKbXDZqtJuRefah1mxZf /NtddXTo1bNhwB84h4lBLL7yaZqW/p41ciyzQmgQjfx4b/VDpf2qblULn7VmHZwaj3i05iCZf t3SG5Sm0T0edhKilXt2Zp2jZequwP409Q3hn+NlmCGn1/NiBUOGKtbBW6wldNxl+YbbYRa+bU Mr9dBVv9i/RiXTovKXFMPuWCr1sGuIpHDz6rgSXdtgI/ZqLYnoN2RzM5fafJSOVGNWQvbxr1d 0K7l2Y2UbibOdPF2QXL+KJIT/ClxuSzQoJZrChAdFUdON7ulOiuBd7zeXJOCCmqh5LCunR5bc lRQ7Hkg9rmtuE5lcV6R9qz7cayJM83jsZpOUznwhzNd66u8NjLyJLLQ4qG8JDmdyBsB7Ck9Wo f0wh9MsqSBzf4Zo1u5oZAD1IxkZqc1vpdsqYAhdjty5SMIe7p+ALn4f27LX0Vf1nzxBHnhZHk nr9tJFJ64s5/iASUNtkOGElaNEW9mmWs39LNr772/1KT6J8CxFDbOGRxEHG6ZIFpWqmUAf00u bx/TQgALY1tnbIEpIyau3hoUuu7pIr3SdcxdH0B0knvQlQzu8/H4CKHsOJyDeWCBrqtGHN/DQ fNBM4bXr+q6pOaT8yKdZzxQsKYuXiRywYmiKFmajmfBJijGHK2yEQbQ4wndhVmClRXZ7AlSlU Jgki++0PRRhcDAHiXzHBkTPwhpYvPSrAwKgj/Y9EPIoVC5XWh2djhO+fB2dXmMe3MBkjGrPD7 nQTbLWG3ywsCXzj3IcltbNm1q4BxhOx5Lkm Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. The safe replacement is strscpy() but in this case it is simpler to add NULL to the first position since we want to empty the string. This is a previous step in the path to remove the strcpy() function. Signed-off-by: Len Baker =2D-- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fb= tft-core.c index 3723269890d5..b8791806cb20 100644 =2D-- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -1037,7 +1037,7 @@ int fbtft_init_display(struct fbtft_par *par) case -1: i++; /* make debug message */ - strcpy(msg, ""); + msg[0] =3D 0; j =3D i + 1; while (par->init_sequence[j] >=3D 0) { sprintf(str, "0x%02X ", par->init_sequence[j]); =2D- 2.25.1