fix: V-001 security vulnerability

Automated security fix generated by OrbisAI Security

Signed-off-by: OrbisAI Security <mediratta01.pally@gmail.com>
This commit is contained in:
orbisai0security 2026-07-09 00:50:36 +00:00 committed by Xiang Xiao
parent 33b528a0de
commit d071a0b585

View file

@ -257,6 +257,11 @@ int nsh_setvar(FAR struct nsh_vtbl_s *vtbl, FAR const char *name,
if (pstate->varp != NULL)
{
if (varlen > INT_MAX - pstate->varsz)
{
return -ENOMEM;
}
newsize = pstate->varsz + varlen;
newvarp = (FAR char *)realloc(pstate->varp, newsize);
if (newvarp == NULL)