5d7612d
diff -up shadow-4.1.4.3/libmisc/find_new_gid.c.IDs shadow-4.1.4.3/libmisc/find_new_gid.c
5d7612d
--- shadow-4.1.4.3/libmisc/find_new_gid.c.IDs	2011-05-20 22:45:27.852146758 +0200
5d7612d
+++ shadow-4.1.4.3/libmisc/find_new_gid.c	2011-05-20 22:47:45.977909798 +0200
5d7612d
@@ -32,6 +32,7 @@
5d7612d
 
5d7612d
 #include <assert.h>
5d7612d
 #include <stdio.h>
5d7612d
+#include <errno.h>
5d7612d
 
5d7612d
 #include "prototypes.h"
5d7612d
 #include "groupio.h"
5d7612d
@@ -65,7 +66,12 @@ int find_new_gid (bool sys_group,
5d7612d
 		gid_max = (gid_t) getdef_ulong ("GID_MIN", 1000UL) - 1;
5d7612d
 		gid_max = (gid_t) getdef_ulong ("SYS_GID_MAX", (unsigned long) gid_max);
5d7612d
 	}
5d7612d
-	used_gids = alloca (sizeof (bool) * (gid_max +1));
5d7612d
+	used_gids = malloc (sizeof (bool) * (gid_max +1));
5d7612d
+	if(used_gids==NULL) {
5d7612d
+                fprintf (stderr,
5d7612d
+                         _("%s: failed to allocate memory. %s\n"), Prog, strerror (errno));
5d7612d
+		return -1;
5d7612d
+	}
5d7612d
 	memset (used_gids, false, sizeof (bool) * (gid_max + 1));
5d7612d
 
5d7612d
 	if (   (NULL != preferred_gid)
5d7612d
diff -up shadow-4.1.4.3/libmisc/find_new_uid.c.IDs shadow-4.1.4.3/libmisc/find_new_uid.c
5d7612d
--- shadow-4.1.4.3/libmisc/find_new_uid.c.IDs	2011-02-13 18:58:11.000000000 +0100
5d7612d
+++ shadow-4.1.4.3/libmisc/find_new_uid.c	2011-05-20 22:47:45.977909798 +0200
5d7612d
@@ -32,6 +32,7 @@
5d7612d
 
5d7612d
 #include <assert.h>
5d7612d
 #include <stdio.h>
5d7612d
+#include <errno.h>
5d7612d
 
5d7612d
 #include "prototypes.h"
5d7612d
 #include "pwio.h"
5d7612d
@@ -65,7 +66,12 @@ int find_new_uid (bool sys_user,
5d7612d
 		uid_max = (uid_t) getdef_ulong ("UID_MIN", 1000UL) - 1;
5d7612d
 		uid_max = (uid_t) getdef_ulong ("SYS_UID_MAX", (unsigned long) uid_max);
5d7612d
 	}
5d7612d
-	used_uids = alloca (sizeof (bool) * (uid_max +1));
5d7612d
+	used_uids = malloc (sizeof (bool) * (uid_max +1));
5d7612d
+	if(used_uids==NULL) {
5d7612d
+                fprintf (stderr,
5d7612d
+                         _("%s: failed to allocate memory. %s\n"), Prog, strerror (errno));
5d7612d
+		return -1;
5d7612d
+	}
5d7612d
 	memset (used_uids, false, sizeof (bool) * (uid_max + 1));
5d7612d
 
5d7612d
 	if (   (NULL != preferred_uid)
5d7612d
@@ -178,6 +184,7 @@ int find_new_uid (bool sys_user,
5d7612d
 		}
5d7612d
 	}
5d7612d
 
5d7612d
+	free(used_uids);
5d7612d
 	*uid = user_id;
5d7612d
 	return 0;
5d7612d
 }