Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1486548pxy; Mon, 2 Aug 2021 02:54:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh7q+vnFGMlONDgmFYfEOsrf06dAjg0iP6k1U7eTKHu64A/cwvhY5Czd+figDm775H3YRg X-Received: by 2002:a05:6402:95a:: with SMTP id h26mr18050109edz.109.1627898052080; Mon, 02 Aug 2021 02:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627898052; cv=none; d=google.com; s=arc-20160816; b=NDTZSz9zlCqMEQvC0Wp9EPImRTQ79QNKcUq/r585AXp8xbhiayioMoUV51giDtOMQo dxFWvjFiL+xksVxo/aSeVpoSAWv+sJk+44/ej/4dWXRBkKhwWHrNnmO2LsRnNdwcXJzK w9c6pNEmqyq4+ZxZXf7JH2L8QYRPueYH7agAwaivhBAYebBZovRRY8v4+hxI4R7cr0c3 sSVPSntxhPfmRl46bZCoKtmBQWp1zZ8arOm3CgucYQAfb6nEtDZrq5e6RcFYWGaCn2ls QLlrPDvgIfkd5a1cbCPDFay16MgULG3uA10bpLMc8XC5uzZTeBKpm6zBqcn4gJ9stCA4 L3fQ== 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=8A+uVFFER9jH+h3mvkXOCYK80p3TMlj1JLXWTceyB2Y=; b=mi+GoMjYauOAonmQwSBHyZtNZ2362JEklGBG/kMsoBs7U1NcNvWcVm0eM5p3ogLlPQ jU1fdNHzTD6YW9Q0Kqy7rsYnkoVhZhR5Ltg+KuG0pO2zuPrn4TwhttLyu6AGLKgKy6SV Cu8dG4LqWFOXtB3LnjEzcYEB+nIbi9VX5aX6/lcp6DnlruvGLyFc1kuR2VAGw10F6fot FS/BogOKSaFNtPQkqk9q6SU6Gsa+GPEhVLyaL59EZ8mFHZysqjpj0wrIYZo6dL9ZM5Kc asaf7F0eieDkiKPI9DY6N1MYytOf0uc8kFXRNs3JF0QRPtezrE6hv8/veDW++HFGPljr bdCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uly2ZZOH; 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 gs6si9293286ejb.32.2021.08.02.02.53.49; Mon, 02 Aug 2021 02:54:12 -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=Uly2ZZOH; 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 S233128AbhHBJwU (ORCPT + 99 others); Mon, 2 Aug 2021 05:52:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:47708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233081AbhHBJwU (ORCPT ); Mon, 2 Aug 2021 05:52:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1CAF760F58; Mon, 2 Aug 2021 09:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627897930; bh=zptMS4fel5KD7SXlEYuE6VYDne/g+jcVh1jlBH3XsIM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Uly2ZZOHomVUxvxd4dtL3RHiqyBuFngfFJP5WtyCMZ9sZmFe3E2SxD4AVGxe/Npun VEZvvoOpQwuY77mjdqPC21GXK97TED11iXTaGT5BmNObZac9RjhkKuwsH012QNTSq7 bie4+LZHo0MvqKxmD4LBG3NTbU7ZmQjvCrMVIesIToDvQDF22ZDmK1qCueBRbkTaD0 VEWwvzV76H4ldtNCyPTpXoKohpkol+Q+Z4PMkv5+TJeTv2VywGdOR/LhGAgEQ81d0x Svg5JFxGV4m77MDo9JcqTp5RL04Ih1taHe71wLE6/PnRFgyUGo6SJvx6bA6gJNepRG jtET/j5QcQbTg== Date: Mon, 2 Aug 2021 11:52:06 +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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02.08.21 11:19:33, Robert Richter wrote: > 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); Another note: Other parts of the code use 'len' instead of 'left', so if you could change that too? Thanks, -Robert > > 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); > > } > >