Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2608773yba; Mon, 22 Apr 2019 09:45:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4uoMdcVIYO4xCL7Wd7BKLZ+79Nd3kt54PG/Y+LByFdlExG/LxcBoNe8ufUalE8TNFP1v/ X-Received: by 2002:a63:d816:: with SMTP id b22mr19536410pgh.349.1555951517516; Mon, 22 Apr 2019 09:45:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951517; cv=none; d=google.com; s=arc-20160816; b=lFUfmtOdj+7NZRaaKRBurvy7Fm8Jr4hVcsJXAM3zHabhcOPt7yOSY4Me4IMxzFG0mw mGEN2GBN8z823O/jM9I1bw1i+kSjbh0+nrcc4LNoozoz2ki7LDsJomh9ca4WhjoqWI4F xlM8pPdlEy/4a/ZkGPk6ImMU3517fdUYyGeLKMx+EFrbAEdmTessN9zLbWe3AwG1a0Me pXOD/KIaT09lOQjJuXLLMCytfuN/zVmKA6OAegAwZQRfmBOs/crT01+isr8Aeh3L+Cvj CI/us9tTC39lCVkW5biUr3zDbmSt1R04sHOBHa2mMTnmKiy4hEFz5HoEYmIwO8+xz9pr PiQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=x0usyEO9j2BpbMWsF4oSIwPxVoq0sgaPQy3jg+Iwa8A=; b=QZ/OxDHbVYlXHr/JU1Diw2Bc25mvrd9elj5g33kVCZaAEJOPJoGs+gI6cON012q1I0 T6AtGU+Rqd7w/A4R/gLEvEiUEN+ELKrmzDZHS8gRE+QhRfyeEOwhojtQO20M1MjdDd/D uNAErph57l8OEq/A1Ho27NSkteZNvamD5R3kI3gu7Z+q2Bm+YjMFq+wY95N8egXqfVGz Dp2DIIuoCo+aHnG65iRrPjhRiISvYFTHcT//N3TseggZYMbpk01d78dH3KZfXPRjJvmP 4JfOjqnWj5uYpiL+Nw0OQysge+1o4frZfh4PRpjt94Todd5Baw/cCxxiSRxepDnv+E/F SKCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cn1si14157233plb.175.2019.04.22.09.45.01; Mon, 22 Apr 2019 09:45:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728113AbfDVQ1O (ORCPT + 99 others); Mon, 22 Apr 2019 12:27:14 -0400 Received: from gateway21.websitewelcome.com ([192.185.46.113]:41255 "EHLO gateway21.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726305AbfDVQ1O (ORCPT ); Mon, 22 Apr 2019 12:27:14 -0400 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 29CAD400C789D for ; Mon, 22 Apr 2019 11:27:13 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id IbmjhJBTkYTGMIbmjhPcS0; Mon, 22 Apr 2019 11:27:13 -0500 X-Authority-Reason: nr=8 Received: from [189.250.104.103] (port=39282 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1hIbmi-001azr-Be; Mon, 22 Apr 2019 11:27:12 -0500 Date: Mon, 22 Apr 2019 11:27:11 -0500 From: "Gustavo A. R. Silva" To: Jason Wessel , Daniel Thompson Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] kdb: kdb_io: Replace strcpy() by strscpy() Message-ID: <20190422162711.GA30856@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.104.103 X-Source-L: No X-Exim-ID: 1hIbmi-001azr-Be X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.104.103]:39282 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 15 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The strcpy() function is being deprecated. Replace it by the safer strscpy() and fix the following Coverity warning: "You might overrun the 256-character fixed-size string kdb_buffer by copying cphold without checking the length." Addresses-Coverity-ID: 138996 ("Copy into fixed size buffer") Signed-off-by: Gustavo A. R. Silva --- kernel/debug/kdb/kdb_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 6a4b41484afe..ebc4aa2d0737 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -836,7 +836,7 @@ int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap) */ if (kdb_grepping_flag && !suspend_grep) { *cphold = replaced_byte; - strcpy(kdb_buffer, cphold); + strscpy(kdb_buffer, cphold, sizeof(kdb_buffer)); len = strlen(kdb_buffer); next_avail = kdb_buffer + len; size_avail = sizeof(kdb_buffer) - len; -- 2.21.0