public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next] net: 6lowpan: replace sprintf() with scnprintf() in debugfs
@ 2026-01-06 17:16 Kathara Sasikumar
  2026-01-09  2:02 ` Jakub Kicinski
  2026-01-09 17:24 ` Simon Horman
  0 siblings, 2 replies; 3+ messages in thread
From: Kathara Sasikumar @ 2026-01-06 17:16 UTC (permalink / raw)
  To: alex.aring, horms
  Cc: davem, edumazet, kuba, pabeni, linux-bluetooth, linux-wpan,
	netdev, linux-kernel, Kathara Sasikumar

sprintf() does not perform bounds checking on the destination buffer.
Replace it with scnprintf() to ensure the write stays within bounds.

No functional change intended.

Signed-off-by: Kathara Sasikumar <katharasasikumar007@gmail.com>
---
v2:
 - Updated commit message wording
 - Targeted the patch to net-next
---
 net/6lowpan/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/6lowpan/debugfs.c b/net/6lowpan/debugfs.c
index 600b9563bfc5..d45ace484143 100644
--- a/net/6lowpan/debugfs.c
+++ b/net/6lowpan/debugfs.c
@@ -173,7 +173,7 @@ static void lowpan_dev_debugfs_ctx_init(struct net_device *dev,
 	if (WARN_ON_ONCE(id >= LOWPAN_IPHC_CTX_TABLE_SIZE))
 		return;
 
-	sprintf(buf, "%d", id);
+	scnprintf(buf, sizeof(buf), "%d", id);
 
 	root = debugfs_create_dir(buf, ctx);
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-09 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06 17:16 [PATCH v2 net-next] net: 6lowpan: replace sprintf() with scnprintf() in debugfs Kathara Sasikumar
2026-01-09  2:02 ` Jakub Kicinski
2026-01-09 17:24 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox