Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4604281imm; Sun, 22 Jul 2018 01:15:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdeZzcGLrm2TCvnv8if+KzJqC+NFBl4lZlvK8IE9zwDg5GoV3gdfzL8MPJoanNXaQmSaenQ X-Received: by 2002:a62:569c:: with SMTP id h28-v6mr8627443pfj.201.1532247301021; Sun, 22 Jul 2018 01:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532247300; cv=none; d=google.com; s=arc-20160816; b=tjsIZvgLkGoJr94WMQLezFVfPQLik0wIFMzU04oGKjuVr5OWQ/yxMnwsrxG8RD6J3p zOJLlelA3TDGQvPE/KXBi4qVrULiIADZJcd+QFNRolisiNHdy/zfcupmqCyUw9mIEvmk z0bKMX0FRmjWIqRpcRVSeF5RJb6vgtD6/S2ObRLT2CU0fJ0dkC3BHE/zDJMFKVWPxTz/ fup9gkQoBRg5p2mVahr25fmzHWx8kgcKWT6Cf3ubJechg16D7naq9N7/0TO7CY+05OcY hgIi977r6/5OYS3ufBBACCBRzx4/KfSR43pC31Do4uBfTo9VG9RjFd6JNsxO75vDWn/B xSNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=lXeEtXz5HuhfkzMVvpqGYYTtwrMWmHbGWjeIjCFLWZ4=; b=DeVem+uvDtfRsntoD/PqukOj1Yl3oXp1nOyl7Rv81TSgvs4XAD9626doGnFLijfqIa QYswzgvm3WWe+Rm6s7J7MLvuRGXBJ+FCAauRhfhJw3jouRS8rB1HvW3WaLLilms97lIy NCRl4uNuTfv3c41L61/sPbB7ecdjYOEIO74qdxQtzIJO4E06TvXJq9z8Rp3/7/uQPujm xpboyhDvTj3dSpDjTD3fBJ9FQi1/9qq7j9LeiHUlLjkFIVwlBAc7PqGzEaV93fMbcCQX OOD0QQIKkh2QKpuzAicou0y4fnw04wQT2mn5OTkA8E0k7fawww52Myew3vsDjuIojuWL zEMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NqV+VbOj; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7-v6si5656586pgn.194.2018.07.22.01.14.46; Sun, 22 Jul 2018 01:15:00 -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=@kernel.org header.s=default header.b=NqV+VbOj; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728323AbeGVJJn (ORCPT + 99 others); Sun, 22 Jul 2018 05:09:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:46778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728001AbeGVJJn (ORCPT ); Sun, 22 Jul 2018 05:09:43 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 28F862086A; Sun, 22 Jul 2018 08:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532247231; bh=lXeEtXz5HuhfkzMVvpqGYYTtwrMWmHbGWjeIjCFLWZ4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NqV+VbOjzjsdUo7VMlDA/s8ayna5bZuR8uRZKE9U12tZE/dZGWhCt3a+fm01aTWZT SDJ91ZSbnFea/7KEAuebUZIdSwXCOYoZ1YOew5zZD+JD2oeDfVZ6uCZvLF+tech9kp 6HILENei0pynNbPOOe+ZzObChV6sc20GtyzlbDvI= Date: Sun, 22 Jul 2018 09:13:47 +0100 From: Jonathan Cameron To: Dominique Martinet Cc: Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Lorenzo Bianconi , Linus Walleij , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 05/18] iio: change strncpy+truncation to strlcpy Message-ID: <20180722091347.1faa81f0@archlinux> In-Reply-To: <20180716114206.GA20555@nautica> References: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> <1531445134-19250-1-git-send-email-asmadeus@codewreck.org> <20180715113907.3813384d@archlinux> <20180716114206.GA20555@nautica> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 Jul 2018 13:42:06 +0200 Dominique Martinet wrote: > Jonathan Cameron wrote on Sun, Jul 15, 2018: > > On Fri, 13 Jul 2018 03:25:34 +0200 > > Dominique Martinet wrote: =20 > > > Generated by scripts/coccinelle/misc/strncpy_truncation.cocci > > >=20 > > > Signed-off-by: Dominique Martinet =20 > >=20 > > Applied to the togreg branch of iio.git and pushed out as testing > > for the autobuilders to play with it. =20 >=20 > Thanks! >=20 > I have been pointed out that strlcpy, unlike strncpy, will read past the > size given in the input string and thus is Bad=E2=84=A2 if the input stri= ng is > not nul terminated. >=20 > After taking the time to check I believe this should not happen as the > original name seems to come from a dentry's d_name after proper > preparation (a buffer is allocated precisely for this purpose), but it > will not hurt to wait for that version. >=20 >=20 > The second reason I was waiting is that I intended to check for each > patch if it is safe to not pad the end of the string with zeroes (to > avoid e.g. information leaks) and that seems OK as well here after a > quick check but I wouldn't trust my own eyes this late so I'll let you > be judge of that if you feel like taking v1 anyway. >=20 > Otherwise, I'll recheck properly and submit a v2 with strscpy and a > better commit message after the coccinelle script is taken for inclusion > and doing a better check but this might take a while longer. >=20 >=20 > Thanks, In this particular case I'm fairly sure it is safe so I'll leave it as is. Thanks, Jonathan