aboutsummaryrefslogtreecommitdiff
path: root/sys/ddb/db_ps.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2016-04-15 09:13:01 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2016-04-15 09:13:01 +0000
commit16952e289fd52b5b717580723e4773f98e31a125 (patch)
tree3e77ec4e817c112201a5d22424f003649e13ab53 /sys/ddb/db_ps.c
parent8310528673f24f21031d49ffdd544f8b9368e35f (diff)
downloadsrc-16952e289fd52b5b717580723e4773f98e31a125.tar.gz
src-16952e289fd52b5b717580723e4773f98e31a125.zip
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 <mark.cave-ayland@ilande.co.uk> MFC after: 1 week
Notes
Notes: svn path=/head/; revision=298043
Diffstat (limited to 'sys/ddb/db_ps.c')
-rw-r--r--sys/ddb/db_ps.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c
index 76ab2c586240..e20b3636bdbb 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)