Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp857331ybe; Wed, 11 Sep 2019 05:56:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhfkMHuV98g2jmSDWst+eZ2sgnWprFa+PumWl++QGeDLF+f1VcvhhC1chcAffsLnvjD6Ja X-Received: by 2002:a17:906:5c49:: with SMTP id c9mr29956139ejr.78.1568206597667; Wed, 11 Sep 2019 05:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568206597; cv=none; d=google.com; s=arc-20160816; b=l8kWtZ/KPUBf3NDb1tnz6ZTWHFV9lfaUuxHP2F1UMqV2SJp0nK8WUKA7lYU7peLT1j ia9IFKOuR3SCJGJlS8G9LXf35ufawj6w+6peDtc256RwlSgMCaQrq7WrlVPvdRW3MMGj KQs7iJCtcmuUsZOFEtQ2j7B8zlVmJ4e5S08jJ/+acdhpR5eFBogVKb6LXr/VCyrAxIiK YulBZucfwE06W9X+YXj2q9DpTGpsPYTDxSRtVZxVnU4fGsLj1W0Yh+jMNMxwj/3PZJvV euzkbUtb/Heo0jDggXyCz+EvvD3RkeXGy5KbCSFIMmVdj6YJc8g+8i0rzWEZ9F06h8Hq 7KlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IQ1uaprAkhL6h68u4f8h/jNHwwMf2X0UUXwYuI2NQ48=; b=htNXdfcaUjxiDruO3uUzWLYk7fGyTxkMkcJXENCRHanFvSz98S2MDg8e7ep4uza04x dpL6EPWsRkjEZR32xINbz3rDQy7JDdTchx/bZwo+myYle6/an50w4OmO4z0Bt+2Etk8f Ku1EtTiYdtMaGODsv3c1ixyDw9K1YzpgqhN6carKY8KTg5F4C3vka2gE3x/REhqzI9Ki u31vIc1abUO0GYv8kGCDFNmAGME0Ql9iTM9FpN3NbrEaAVvKw67f9SeVVEZiIgoXtSmJ NW5rRTwhpXPUMGnJmGgso6ja8deklPeymb0WW98BxwcoVDVKGGlb6UbNubsOAUFcC/zg 1KPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=HOvJOWoj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si3637752edn.332.2019.09.11.05.56.13; Wed, 11 Sep 2019 05:56:37 -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; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=HOvJOWoj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727803AbfIKMwJ (ORCPT + 99 others); Wed, 11 Sep 2019 08:52:09 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:38640 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726954AbfIKMwI (ORCPT ); Wed, 11 Sep 2019 08:52:08 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8BCdQjH098177; Wed, 11 Sep 2019 12:52:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=IQ1uaprAkhL6h68u4f8h/jNHwwMf2X0UUXwYuI2NQ48=; b=HOvJOWojd20Ghle9MviSjvqIEk7YDSBw48NAWGKVDnITpXEVfYFHPjnotFYnLRDUV7r7 qIYVMH2bmrkH3QnZhclumNk4otMxA/tYEpbN36G8plYtr4Ks+muXs9UNVOOlXUujwp++ XROT5UW8S+mGMUnCwuc5J9Um/Ie5Zjh2jbSo1bjdhcCLx9pqu3zWLnU0NOqh95ZNhSBW ali25taOUZx7P5gH7saZrHzrwyx3kyYJcRQ5AYGjirz7qfMRqy+OWeE2ERyUNf6+SaMs nZ+jXpnJ0YA40t5LRyHclPUFWhJ5EZGt5MvGnKvYftB+V51TpqTgDlND1vSFPhCxrFRk PQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2uw1m91trx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Sep 2019 12:52:03 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8BCiMKC171520; Wed, 11 Sep 2019 12:52:03 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2uxj88rfe6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Sep 2019 12:52:03 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x8BCq0Ok009037; Wed, 11 Sep 2019 12:52:01 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 11 Sep 2019 05:52:00 -0700 Date: Wed, 11 Sep 2019 15:51:54 +0300 From: Dan Carpenter To: Sandro Volery Cc: valdis.kletnieks@vt.edu, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux@rasmusvillemoes.dk Subject: Re: [PATCH v3] Staging: exfat: Avoid use of strcpy Message-ID: <20190911125154.GI20699@kadam> References: <20190911124812.GA25324@volery> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190911124812.GA25324@volery> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9376 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1909110117 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9376 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1909110117 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 11, 2019 at 02:48:12PM +0200, Sandro Volery wrote: > Use strscpy instead of strcpy in exfat_core.c, and add a check > for length that will return already known FFS_INVALIDPATH. > > Suggested-by: Rasmus Villemoes > Signed-off-by: Sandro Volery > --- > v3: Fixed replacing mistake > v2: Introduced length check > v1: Original patch > drivers/staging/exfat/exfat_core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c > index da8c58149c35..4c40f1352848 100644 > --- a/drivers/staging/exfat/exfat_core.c > +++ b/drivers/staging/exfat/exfat_core.c > @@ -2964,7 +2964,8 @@ s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir, > if (strlen(path) >= (MAX_NAME_LENGTH * MAX_CHARSET_SIZE)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Get rid of this. > return FFS_INVALIDPATH; > > - strcpy(name_buf, path); > + if (strscpy(name_buf, path, sizeof(name_buf)) < 0) > + return FFS_INVALIDPATH; regards, dan carpenter