When addr is equal to zero, array access from pointer threads
results in a dereference of null pointer. Avoid this by checking
if it's NULL.
* kern/processor.c (threads): Check if it's NULL.
---
kern/processor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kern/processor.c b/kern/processor.c
index 0cb9974..9da06f5 100644
--- a/kern/processor.c
+++ b/kern/processor.c
@@ -924,7 +924,8 @@ processor_set_things(
thread = (thread_t) queue_next(&thread->pset_threads)) {
/* take ref for convert_thread_to_port */
thread_reference(thread);
- threads[i] = thread;
+ if (threads != (thread_t *)0)
+ threads[i] = thread;
}
assert(queue_end(&pset->threads, (queue_entry_t) thread));
break;
--
1.8.1.4