Blame SOURCES/shadow-4.6-usermod-crash.patch

4fb1b2
diff -up shadow-4.6/libmisc/prefix_flag.c.usermod-crash shadow-4.6/libmisc/prefix_flag.c
4fb1b2
--- shadow-4.6/libmisc/prefix_flag.c.usermod-crash	2018-04-29 18:42:37.000000000 +0200
4fb1b2
+++ shadow-4.6/libmisc/prefix_flag.c	2018-05-28 15:14:10.642302440 +0200
4fb1b2
@@ -319,6 +319,7 @@ extern struct group *prefix_getgr_nam_gi
4fb1b2
 {
4fb1b2
 	long long int gid;
4fb1b2
 	char *endptr;
4fb1b2
+	struct group *g;
4fb1b2
 
4fb1b2
 	if (NULL == grname) {
4fb1b2
 		return NULL;
4fb1b2
@@ -333,7 +334,8 @@ extern struct group *prefix_getgr_nam_gi
4fb1b2
 	    	&& (gid == (gid_t)gid)) {
4fb1b2
 			return prefix_getgrgid ((gid_t) gid);
4fb1b2
 		}
4fb1b2
-		return prefix_getgrnam (grname);
4fb1b2
+		g = prefix_getgrnam (grname);
4fb1b2
+		return g ? __gr_dup(g) : NULL;
4fb1b2
 	}
4fb1b2
 	else
4fb1b2
 		return getgr_nam_gid(grname);
4fb1b2
diff -up shadow-4.6/src/usermod.c.usermod-crash shadow-4.6/src/usermod.c
4fb1b2
--- shadow-4.6/src/usermod.c.usermod-crash	2018-05-28 15:12:37.920332763 +0200
4fb1b2
+++ shadow-4.6/src/usermod.c	2018-05-28 15:15:50.337422470 +0200
4fb1b2
@@ -1276,11 +1276,13 @@ static void process_flags (int argc, cha
4fb1b2
 		prefix_user_home = xmalloc(len);
4fb1b2
 		wlen = snprintf(prefix_user_home, len, "%s/%s", prefix, user_home);
4fb1b2
 		assert (wlen == (int) len -1);
4fb1b2
+		if (user_newhome) {
4fb1b2
+			len = strlen(prefix) + strlen(user_newhome) + 2;
4fb1b2
+			prefix_user_newhome = xmalloc(len);
4fb1b2
+			wlen = snprintf(prefix_user_newhome, len, "%s/%s", prefix, user_newhome);
4fb1b2
+			assert (wlen == (int) len -1);
4fb1b2
+		}
4fb1b2
 
4fb1b2
-		len = strlen(prefix) + strlen(user_newhome) + 2;
4fb1b2
-		prefix_user_newhome = xmalloc(len);
4fb1b2
-		wlen = snprintf(prefix_user_newhome, len, "%s/%s", prefix, user_newhome);
4fb1b2
-		assert (wlen == (int) len -1);
4fb1b2
 	}
4fb1b2
 	else {
4fb1b2
 		prefix_user_home = user_home;