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

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