linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linearize.c: fix potential buffer overrun
@ 2023-02-22 15:52 Jeff Layton
  2023-12-18 13:56 ` Luc Van Oostenryck
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2023-02-22 15:52 UTC (permalink / raw)
  To: linux-sparse; +Cc: luc.vanoostenryck

The resulting string won't be nearly 64 bytes, but "buf" is only 16
bytes long here, and this causes FORTIFY_SOURCE to barf when given the
right options.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 linearize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linearize.c b/linearize.c
index d9aed61b361f..1db2d505a7d4 100644
--- a/linearize.c
+++ b/linearize.c
@@ -91,7 +91,7 @@ const char *show_label(struct basic_block *bb)
 
 	if (!bb)
 		return ".L???";
-	snprintf(buf, 64, ".L%u", bb->nr);
+	snprintf(buf, 16, ".L%u", bb->nr);
 	return buf;
 }
 
-- 
2.39.2


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

* Re: [PATCH] linearize.c: fix potential buffer overrun
  2023-02-22 15:52 [PATCH] linearize.c: fix potential buffer overrun Jeff Layton
@ 2023-12-18 13:56 ` Luc Van Oostenryck
  0 siblings, 0 replies; 2+ messages in thread
From: Luc Van Oostenryck @ 2023-12-18 13:56 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-sparse, luc.vanoostenryck

On Wed, Feb 22, 2023 at 10:52:44AM -0500, Jeff Layton wrote:
> The resulting string won't be nearly 64 bytes, but "buf" is only 16
> bytes long here, and this causes FORTIFY_SOURCE to barf when given the
> right options.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Pushed to mainline now. Sorry for this very long delay.
-- Luc

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

end of thread, other threads:[~2023-12-18 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 15:52 [PATCH] linearize.c: fix potential buffer overrun Jeff Layton
2023-12-18 13:56 ` Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).