* [PATCH] ARM: i.MX: phytec-som-imx6: use strdup instead of basprintf
@ 2024-02-20 12:20 Ahmad Fatoum
2024-02-23 7:32 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-02-20 12:20 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Using basprintf to duplicate a string violates memory safety if
default_environment_path were to contain a format specifier.
clangd warns about this, so fix this by using strdup instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/boards/phytec-som-imx6/board.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boards/phytec-som-imx6/board.c b/arch/arm/boards/phytec-som-imx6/board.c
index bff95221abf3..2db3fa1db8cd 100644
--- a/arch/arm/boards/phytec-som-imx6/board.c
+++ b/arch/arm/boards/phytec-som-imx6/board.c
@@ -231,7 +231,7 @@ static int physom_imx6_probe(struct device *dev)
envdev = "SPI NOR flash";
break;
default:
- environment_path = basprintf(default_environment_path);
+ environment_path = strdup(default_environment_path);
envdev = default_envdev;
break;
}
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: i.MX: phytec-som-imx6: use strdup instead of basprintf
2024-02-20 12:20 [PATCH] ARM: i.MX: phytec-som-imx6: use strdup instead of basprintf Ahmad Fatoum
@ 2024-02-23 7:32 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-02-23 7:32 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Tue, 20 Feb 2024 13:20:04 +0100, Ahmad Fatoum wrote:
> Using basprintf to duplicate a string violates memory safety if
> default_environment_path were to contain a format specifier.
>
> clangd warns about this, so fix this by using strdup instead.
>
>
Applied, thanks!
[1/1] ARM: i.MX: phytec-som-imx6: use strdup instead of basprintf
https://git.pengutronix.de/cgit/barebox/commit/?id=e29607037621 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-23 7:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 12:20 [PATCH] ARM: i.MX: phytec-som-imx6: use strdup instead of basprintf Ahmad Fatoum
2024-02-23 7:32 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox