Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1470281pxy; Mon, 2 Aug 2021 02:21:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQdxUlpN1/+gH8SWZXknJ8HCFIbAGYa2UBMuXHG3zU2IsxlRJ1pE726slIXwS3pGmL3b1J X-Received: by 2002:a92:db4b:: with SMTP id w11mr9630ilq.297.1627896087549; Mon, 02 Aug 2021 02:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627896087; cv=none; d=google.com; s=arc-20160816; b=NqbwoJLrmntEVYeYDIZT+Pk4QfeXwqqc6whQizSOfFgBZKMHsGWQuAuvLl2qBrmKP+ h8wTfeHRRqXZRab0IpFt4rKe3jkNDflosP+ZPzZd7AeueneY8NEPt1OYf6UxdzNQ4xqa b849OarMn5RLz7N287UBEect1aAimWBBCHvPyeT6FqOu4CEw6SiEvXlPx4E4wKhI4VFE bElD5L/0/ESSq0cbQbmtBeM/r13h2Nzu55Is8t/WAlqlD/wrNDoxnClpaoCEE1O2qPpc UmTk/f86W43vVPyzh9g+i0RF+O6q9j3uKB8BZs2OYUaki9qf3g7Yz3Tmg7xQvEyEv1Sn 5Fng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=73u2TMGju3wvINsyigraqGHyVYwoeFuihyX5Ta62pb4=; b=qzoKZc9JUagyN+pK5q5E6Ti9GGoRjjKyaSm7fkOXjqwYea0a81o0sm9yac5nTXdotf I8iQY3LUei8s1C/X4vXwAJGjPexsE4Yr/rVG2B2rO3XNCBcdADUZq9nNU5Jm6fw4QTDL ZVwc6vHqkMCGdCFlcdE/UamJVZfqFx81f74RrtsmMpj1IKmfJ5iBMz5Nk8rZBjkET2F9 F8U24pFkSq7YHGguRTCrHtlrM+vGPZf/q3U7d6nUWqg7KakqpSBHZ103npdP8La9Rocd xN5fgNWzFfrQrY8HcjJz8kNMPiT3gM6fwG5Yjc/oJxRDqWgL0C6QtrNgwxhZcL63OZo2 MM7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gCkyiEew; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p37si11338585jal.38.2021.08.02.02.21.16; Mon, 02 Aug 2021 02:21:27 -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=@kernel.org header.s=k20201202 header.b=gCkyiEew; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232988AbhHBJTm (ORCPT + 99 others); Mon, 2 Aug 2021 05:19:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:34034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232670AbhHBJTm (ORCPT ); Mon, 2 Aug 2021 05:19:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A32E604AC; Mon, 2 Aug 2021 09:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627895973; bh=29PlLx4+thAtabDg3X7ZcbW+1opEQwWBH6fLFAHy3Co=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gCkyiEewi29jbnkIJdo/yqVWamGdF2Ka6tXJP0HHqwzWu3BVkM9jFVmZ7b9e1g5Vk wUW5y+tcdhWoBsSXOgPdxsrBTCjQC9HRrBb0dAdcCDMAg0SOIOX1dqCPHrD2rBJza3 d0b1a9L/MS5oEU/pGCoQrj13H6RV9aUGQfT57dv3ETNLhdeBldMMjIOY5gygVwBs54 czf9u3FT5HlECCXFj2by2ap70HaablB3zexjp8nJE9KbAs3VqoFG7ZJgzeFUbsZoPE ZExHSwF1Aon476OvHYsl5DFEYZ+q1jj4AGnr8p/4qYXa968ZYr2XyCr8nqzbLFI60/ trO7kXNe2Pu2g== Date: Mon, 2 Aug 2021 11:19:27 +0200 From: Robert Richter To: Len Baker Cc: Kees Cook , Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , James Morse , linux-hardening@vger.kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] drivers/edac/edac_mc: Remove all strcpy() uses Message-ID: References: <20210801143558.12674-1-len.baker@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210801143558.12674-1-len.baker@gmx.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01.08.21 16:35:58, Len Baker wrote: > @@ -1114,10 +1116,12 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, > *p = '\0'; > } else { > if (p != e->label) { > - strcpy(p, OTHER_LABEL); > + strscpy(p, OTHER_LABEL, left); > + left -= strlen(OTHER_LABEL); > p += strlen(OTHER_LABEL); Those both must be strlen(p) now as otherwise 'left' could underflow (and p overflow). -Robert > } > - strcpy(p, dimm->label); > + strscpy(p, dimm->label, left); > + left -= strlen(p); > p += strlen(p); > } >