mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 12:55:43 +08:00
Fixes for problems found by Coverity in the apps/ repository:
nshlib/nsh_parse.c: Avoid truncating the strcmp result into a unsigned char variable. nshlib/nsh_netcmds.c: Check for valid hostip before using it. nshlib/nsh_ddcmd.c: Fix resouce leak when 'if=' or 'of=' params are repeated in the command line. For example: dd if=/dev/null if=/dev/zero of=/dev/null or dd if=/dev/zero of=/dev/zero of=/dev/null
This commit is contained in:

committed by
Gregory Nutt

parent
873e4ee83e
commit
3fe720d1e2
@@ -1497,10 +1497,10 @@ static int nsh_loop(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
||||
{
|
||||
/* Check if the command is preceded by "while" or "until" */
|
||||
|
||||
whilematch = strcmp(cmd, "while");
|
||||
untilmatch = strcmp(cmd, "until");
|
||||
whilematch = strcmp(cmd, "while") == 0;
|
||||
untilmatch = strcmp(cmd, "until") == 0;
|
||||
|
||||
if (whilematch == 0 || untilmatch == 0)
|
||||
if (whilematch || untilmatch)
|
||||
{
|
||||
uint8_t state;
|
||||
|
||||
|
Reference in New Issue
Block a user