From nobody Tue Apr 7 17:12:26 2026 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 920A113B5AE for ; Fri, 27 Feb 2026 00:49:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772153387; cv=none; b=kk68kG4wggylU/Cdm82Vckavvtikg0eHSb0wR/gTbs/jHffCxAn0o4+MEkg5k8uxNjhUS61+j2mfnuslZjkRIfLD8jbwRAH123WVJK+zdnUZjuore97lwKfxkBNhLBmyn4HuPX4QFSWgAdfOz+mDnD9ANQSH9wKm/W++Hi+gr7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772153387; c=relaxed/simple; bh=kxJVxLCX5045kFo1+0Jf+w+pRVLSmR6CixwiNorUPsc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EbpW4BEblqg4LjlKb0mKYf+4Ha/9Kpz76aUHtiTBsCeCo4herazm985tmahYsgeB0XvTpy6xkU0TyvmpeqO2WHLG3ZYYkAGFRzXEIYOEfnX1VE9jIFEhNlxQqxdLKFnbWXEc8U1dfONk1YuKTm68wFwfN5uzUH7AfGWL+S9Mt2w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=kDwQeI87; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="kDwQeI87" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772153373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nLHgLpQjDCa3lA8XrBt/6vgxD7NRkmc2emKglDrIsHE=; b=kDwQeI87Ykhgi3HNg0qgSymihkObjAwonqSWlOHKJu3nRvlCWWNEm5AqhZz1BszeeRAEkS PDC1Gh0g5UcbaXs5/ERkjJ83YQsv8nxrxR+XJ41Rawf9z7cUTCQqkTWiwjplvB/tWoQOW2 yYanmcwSzef7W5KF3AxphFezrM2ftWA= From: Thorsten Blum To: "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: Thorsten Blum , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next] ipv6: sit: Replace deprecated strcpy with strscpy Date: Fri, 27 Feb 2026 01:45:42 +0100 Message-ID: <20260227004541.798966-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" strcpy() has been deprecated [1] because it performs no bounds checking on the destination buffer, which can lead to buffer overflows. Replace it with the safer strscpy(). Use the two-argument version of strscpy() to copy 'parms->name' in ipip6_tunnel_locate(). Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy= [1] Signed-off-by: Thorsten Blum --- net/ipv6/sit.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 439c8a1c6625..52f105315e1e 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -256,9 +257,9 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net= *net, if (parms->name[0]) { if (!dev_valid_name(parms->name)) goto failed; - strscpy(name, parms->name, IFNAMSIZ); + strscpy(name, parms->name); } else { - strcpy(name, "sit%d"); + strscpy(name, "sit%d"); } dev =3D alloc_netdev(sizeof(*t), name, NET_NAME_UNKNOWN, ipip6_tunnel_setup); @@ -275,7 +276,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net= *net, goto failed_free; =20 if (!parms->name[0]) - strcpy(parms->name, dev->name); + strscpy(parms->name, dev->name); =20 return nt; =20 @@ -1442,7 +1443,7 @@ static int ipip6_tunnel_init(struct net_device *dev) int err; =20 tunnel->dev =3D dev; - strcpy(tunnel->parms.name, dev->name); + strscpy(tunnel->parms.name, dev->name); =20 ipip6_tunnel_bind_dev(dev); =20 @@ -1863,7 +1864,7 @@ static int __net_init sit_init_net(struct net *net) ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); ipip6_fb_tunnel_init(sitn->fb_tunnel_dev); =20 - strcpy(t->parms.name, sitn->fb_tunnel_dev->name); + strscpy(t->parms.name, sitn->fb_tunnel_dev->name); return 0; =20 err_reg_dev: --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4