sched/env: Check for incoming parameter validity in unsetenv()

Something the function did not do, check the incoming parameter is vlaid
This commit is contained in:
Ville Juven 2022-06-13 15:51:12 +03:00 committed by Petro Karashchenko
parent 1b32fc1642
commit dc2b2dcb3f
1 changed files with 9 additions and 1 deletions

View File

@ -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 */