about summary refs log tree commit diff
path: root/src/passwd/getgrent_a.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/passwd/getgrent_a.c')
-rw-r--r--src/passwd/getgrent_a.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/passwd/getgrent_a.c b/src/passwd/getgrent_a.c
index ccb51d52..7c63c57b 100644
--- a/src/passwd/getgrent_a.c
+++ b/src/passwd/getgrent_a.c
@@ -37,10 +37,14 @@ struct group *__getgrent_a(FILE *f, struct group *gr, char **line, size_t *size,
 		*line = 0;
 		return 0;
 	}
-	mem[0][0] = mems;
-	for (s=mems, i=0; *s; s++)
-		if (*s==',') *s++ = 0, mem[0][++i] = s;
-	mem[0][++i] = 0;
+	if (*mems) {
+		mem[0][0] = mems;
+		for (s=mems, i=0; *s; s++)
+			if (*s==',') *s++ = 0, mem[0][++i] = s;
+		mem[0][++i] = 0;
+	} else {
+		mem[0][0] = 0;
+	}
 	gr->gr_mem = *mem;
 	return gr;
 }