diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-02-24 11:23:15 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-02-24 11:23:15 +0000 |
commit | 426cd68f74bb0490df54da500d3d9c1ea475e16f (patch) | |
tree | d586b6574e57108eb668faf58b3f9281c65c603b /source3 | |
parent | 0e6dbeb2737700ece2a4502a6edf094f4f26894c (diff) | |
download | samba-426cd68f74bb0490df54da500d3d9c1ea475e16f.tar.gz samba-426cd68f74bb0490df54da500d3d9c1ea475e16f.tar.bz2 samba-426cd68f74bb0490df54da500d3d9c1ea475e16f.zip |
Move off-by-one buggy malloc()/safe_strcpy() combination to strdup() instead.
Andrew Bartlett
(This used to be commit c26881633d8a7f6d9b9ed9c6a97ce2b45bf2b317)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/util_getent.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/source3/lib/util_getent.c b/source3/lib/util_getent.c index 7d45287bba..32641dbf83 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 = (char *)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; |