summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-02-24 19:22:54 +0000
committerJeremy Allison <jra@samba.org>2003-02-24 19:22:54 +0000
commit11c3fdbc5139cc6cef8c2dc12aa54b69baa7cc7d (patch)
tree25320f8ebc0ab1120e15fb010cfe72ec25e38700
parent1a2035a8f529e7831754fd8e0fc07dd2222deddd (diff)
downloadsamba-11c3fdbc5139cc6cef8c2dc12aa54b69baa7cc7d.tar.gz
samba-11c3fdbc5139cc6cef8c2dc12aa54b69baa7cc7d.tar.bz2
samba-11c3fdbc5139cc6cef8c2dc12aa54b69baa7cc7d.zip
Merge from head. Move off-by-one buggy malloc()/safe_strcpy() combination to strdup() instead.
Jeremy. (This used to be commit 6521601bf8013c8809db13ccf7dd256ea4ad5dd7)
-rw-r--r--source3/lib/util_getent.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/source3/lib/util_getent.c b/source3/lib/util_getent.c
index 7d45287bba..ef01dd5947 100644
--- a/source3/lib/util_getent.c
+++ b/source3/lib/util_getent.c
@@ -224,18 +224,16 @@ static struct sys_userlist *add_members_to_userlist(struct sys_userlist *list_he
for (i = 0; i < num_users; i++) {
struct sys_userlist *entry = (struct sys_userlist *)malloc(sizeof(*entry));
- size_t len = strlen(grp->gr_mem[i])+1;
if (entry == NULL) {
free_userlist(list_head);
return NULL;
}
- entry->unix_name = (char *)malloc(len);
+ entry->unix_name = strdup(grp->gr_mem[i]);
if (entry->unix_name == NULL) {
SAFE_FREE(entry);
free_userlist(list_head);
return NULL;
}
- safe_strcpy(entry->unix_name, grp->gr_mem[i],len);
DLIST_ADD(list_head, entry);
}
return list_head;