diff --git a/NEWS b/NEWS
index e2edf06b7637bf304e87c46cb0c7b63afd7cbe34..bbfb4a1bf3402b542cf18583ca32e78368d6a02c 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ documents those changes that are of interest to users and administrators.
 ===========================
  -- Do not attempt to power down a node which has never responded if the
     slurmctld daemon restarts without state.
+ -- Fix for possible slurmstepd segfault on invalid userr ID.
 
 * Changes in Slurm 15.08.11
 ===========================
diff --git a/src/slurmd/slurmstepd/mgr.c b/src/slurmd/slurmstepd/mgr.c
index 48df1be02eb6acf52ec686d322bb729229ddf3e2..439c0ac32412e3844cae6ecd79513a37e3ebb1c4 100644
--- a/src/slurmd/slurmstepd/mgr.c
+++ b/src/slurmd/slurmstepd/mgr.c
@@ -2604,7 +2604,7 @@ _get_primary_group(const char *user, gid_t *gid)
 	int cc;
 
 	cc = getpwnam_r(user, &pwd, buf, sizeof(buf), &pwd0);
-	if (cc != 0) {
+	if ((cc != 0) || (pwd0 == NULL)) {
 		error("%s: getpwnam_r() failed: %m", __func__);
 		return -1;
 	}