libc/environ: add interrupt context check to getenv

Prevent getenv() from being called in interrupt context by adding
up_interrupt_context() check. This ensures thread-safe access to
environment variables in multi-threaded scenarios.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2025-05-16 21:06:21 +08:00
committed by Xiang Xiao
parent 5fb2ff3fe9
commit 0b96303fda
+1 -1
View File
@@ -67,7 +67,7 @@ FAR char *getenv(FAR const char *name)
/* Verify that a string was passed */
if (name == NULL)
if (name == NULL || up_interrupt_context())
{
ret = -EINVAL;
goto errout;