You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/06/14 07:40:00 UTC
[incubator-nuttx] 02/02: sched/env: Check for incoming parameter validity in unsetenv()
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit dc2b2dcb3f7f4561f880fbbbaa60fab90984ffa4
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Mon Jun 13 15:51:12 2022 +0300
sched/env: Check for incoming parameter validity in unsetenv()
Something the function did not do, check the incoming parameter is vlaid
---
sched/environ/env_unsetenv.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sched/environ/env_unsetenv.c b/sched/environ/env_unsetenv.c
index be491474c4..62f9fd8a99 100644
--- a/sched/environ/env_unsetenv.c
+++ b/sched/environ/env_unsetenv.c
@@ -63,7 +63,15 @@ int unsetenv(FAR const char *name)
FAR struct task_group_s *group = rtcb->group;
int idx;
- DEBUGASSERT(name && group);
+ DEBUGASSERT(group);
+
+ /* Check the incoming parameter */
+
+ if (name == NULL || *name == '\0' || strchr(name, '=') != NULL)
+ {
+ set_errno(EINVAL);
+ return ERROR;
+ }
/* Check if the variable exists */