[PATCH v2] shell.c: Fix Dereference after null check (CID #26083)
Ryan Long
ryan.long at oarcorp.com
Thu Mar 11 22:17:27 UTC 2021
CID 26083: Dereference after null check in rtems_shell_login().
Closes #4327
---
cpukit/libmisc/shell/shell.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 1e5962b..ad47460 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -789,6 +789,8 @@ static bool rtems_shell_login(rtems_shell_env_t *env, FILE * in,FILE * out)
}
}
+ _Assert(out != NULL);
+
return rtems_shell_login_prompt(in, out, env->devname, env->login_check);
}
@@ -966,6 +968,9 @@ bool rtems_shell_main_loop(
"shell: cannot allocate prompt memory\n");
}
+ _Assert(stdin != NULL);
+ _Assert(stdout != NULL);
+
shell_std_debug("child out: %d (%p)\n", fileno(stdout), stdout);
shell_std_debug("child in: %d (%p)\n", fileno(stdin), stdin);
--
1.8.3.1
More information about the devel
mailing list