From 0e7cffb825b2a74071888588f71a2d3b79f5b703 Mon Sep 17 00:00:00 2001 From: kib Date: Fri, 15 Apr 2016 09:13:01 +0000 Subject: Avoid NULL pointer dereference, for a process which is not (yet) a member of a process group, e.g. during the system bootstrap. Submitted by: Mark Cave-Ayland MFC after: 1 week --- sys/ddb/db_ps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/ddb') diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c index 76ab2c5..e20b363 100644 --- a/sys/ddb/db_ps.c +++ b/sys/ddb/db_ps.c @@ -184,7 +184,8 @@ db_ps(db_expr_t addr, bool hasaddr, db_expr_t count, char *modif) strlcat(state, "V", sizeof(state)); if (p->p_flag & P_SYSTEM || p->p_lock > 0) strlcat(state, "L", sizeof(state)); - if (p->p_session != NULL && SESS_LEADER(p)) + if (p->p_pgrp != NULL && p->p_session != NULL && + SESS_LEADER(p)) strlcat(state, "s", sizeof(state)); /* Cheated here and didn't compare pgid's. */ if (p->p_flag & P_CONTROLT) -- cgit v1.1