Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp686381ybe; Wed, 11 Sep 2019 03:09:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxrD1QgMtwKBr1ZFFii3dAHCy32b+FVTjQYj+iii0yhD8kAwkk/Cqm5HlcKAmAA6pPhhqvB X-Received: by 2002:a17:906:3659:: with SMTP id r25mr13057199ejb.53.1568196561425; Wed, 11 Sep 2019 03:09:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568196561; cv=none; d=google.com; s=arc-20160816; b=v//fmHoZUlVe4DVFTRPJONCXypxPDJhfNIh05CKBqeZeE/VSALzUYc0+Kix4qDFFUB pvO5MSlLVdpMJQLytkzSSrIc7g7z4O1SeM3DbF5BYkadvw5c3WQHruR7R/2ng3tBk9Od WAJ1RoYA9fVYEHswTC53PV7l4JVbTiiI+MTtw6u4Pt4ccGUWSTy+3or7Yu4Be1z9u1BM CIHnUfaOGN0unwSSmvrFkCvNI1L2MWpOxYqyZdGuhgoSYTcQBwYhgMmADDNwQL+zwNEf Gek49Ap9WggOWEUq/+ohrSkIU9nB6QFTHLohMFLBIADR2aRM7Yl02+F3DBlnkypwtQol 9Xng== 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=qOLyzRXpaKhkfGkIXyyUeY3+rMQ9FP1s2LnG0Y7Q98k=; b=1JubWSiA5yq2V1Gf9p/zJkBxqNJAq/qe6hz/BTAxyc7O/SSRRr25/t0yQesjHwlgel T0Xw69DyKEKwUciV45vT+B5YKxlqjKMjTsr0keTM02QROFmmqpqqVSgGEhVUP2XbJj5l Tie4qBUeTnJxcY2yq+/kGVveIOiY+LQ+fs3sppsJBEp019OKnv6tQcW5AxKnEuLDKCyU 6Rpqm/aM/NvD/ASt2/KuRxf+3NHanangfrO/Q4nq0LMfeCNX5BMLrfDSji/ZFDlPzr/p Merc4SzNQVfBtGOFUrc6YR2jCCVhW0FxSMXLyEF88p8ofccI8jcLCg4buJbKSkfn/ezI Yehw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b="BdaI0/H8"; 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 w55si13500152eda.15.2019.09.11.03.08.56; Wed, 11 Sep 2019 03:09:21 -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="BdaI0/H8"; 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 S1727610AbfIKKGd (ORCPT + 99 others); Wed, 11 Sep 2019 06:06:33 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:56372 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727491AbfIKKGd (ORCPT ); Wed, 11 Sep 2019 06:06:33 -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 x8B9rdYg152061; Wed, 11 Sep 2019 10:06:28 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=qOLyzRXpaKhkfGkIXyyUeY3+rMQ9FP1s2LnG0Y7Q98k=; b=BdaI0/H89Q3k9Pxph7i4Uj2f91Z7CdJpwIg1c/YRLBiPcJCLfyUu3bCOifF79xPA8U9K DMNpwSBgV13FG0LuWS4EXKhn72Eq/XlgcbB6g+buGP1NvlkxICQsBnfFZ9su4TmqsMmC A7gecSiGq3Vrm7JXHiwtSx47GPXaWFYs159tvLNWfPpJ/UnXtPJiSg8ckX54xzxosB2F L/4/StW2EGMKWu54zViy47mU6lsziFNNOx/x0vh/ieKVxlPuUAUmv3jCaZU9815T8MBl zcM0PjzM2mc/hM7pBh06dZ/z3DztJz2LOU8SiogCO/hw6ntGcTz9ISzPr2Zc3oHv7Ju0 iA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2uw1m90wvv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Sep 2019 10:06:28 +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 x8B9rbd4168626; Wed, 11 Sep 2019 10:06:27 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2uxj88mapm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Sep 2019 10:06:27 +0000 Received: from abhmp0022.oracle.com (abhmp0022.oracle.com [141.146.116.28]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x8BA6Nvn023397; Wed, 11 Sep 2019 10:06:23 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 11 Sep 2019 03:06:22 -0700 Date: Wed, 11 Sep 2019 13:06:16 +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 v2] Staging: exfat: Avoid use of strcpy Message-ID: <20190911100616.GH20699@kadam> References: <20190911094219.GA22438@volery> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190911094219.GA22438@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-1909110093 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=1011 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-1909110093 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 11:42:19AM +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 > --- > v2: Implement length check and return in one > 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)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Delete this as it is no longer required. > return FFS_INVALIDPATH; > > - strcpy(name_buf, path); > + if (strscpy(name_buf, path, sizeof(name_buf)) < 0) > + return FFS_INVALIDPATH; regards, dan carpenter