Add missing boundary validation for pid
valid pid range is from 0 to g_lastpid. anything beyond
this range is invalid pid. Hence add proper validation
@@ -101,7 +101,7 @@ FAR struct tcb_s *sched_gettcb(pid_t pid)
/* Verify that the PID is within range */
- if (pid >= 0) {
+ if (pid >= 0 && pid <= g_lastpid) {
/* Get the hash_ndx associated with the pid */
hash_ndx = PIDHASH(pid);
