2007-10-07 17:14:02 +05:30
|
|
|
/*
|
2021-12-05 21:05:27 +05:30
|
|
|
* SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
|
|
|
|
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
|
|
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
2007-10-07 17:14:02 +05:30
|
|
|
*
|
2021-12-05 21:05:27 +05:30
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2007-10-07 17:14:02 +05:30
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-11-11 05:16:11 +05:30
|
|
|
#ident "$Id$"
|
2007-10-07 17:17:01 +05:30
|
|
|
|
2008-08-31 00:00:15 +05:30
|
|
|
#include <assert.h>
|
2007-10-07 17:14:02 +05:30
|
|
|
#include "prototypes.h"
|
|
|
|
#include "defines.h"
|
|
|
|
/*
|
|
|
|
* add_list - add a member to a list of group members
|
|
|
|
*
|
|
|
|
* the array of member names is searched for the new member
|
|
|
|
* name, and if not present it is added to a freshly allocated
|
|
|
|
* list of users.
|
|
|
|
*/
|
* libmisc/xgetXXbyYY.c, libmisc/myname.c, libmisc/getgr_nam_gid.c,
libmisc/salt.c, libmisc/list.c, libmisc/cleanup.c, src/login.c,
lib/getdef.h, lib/groupio.c, lib/getlong.c, lib/gshadow_.h,
lib/sgroupio.c, lib/shadowio.c, lib/pwio.c, lib/commonio.h,
lib/fputsx.c, lib/prototypes.h: Added splint annotations.
* lib/groupio.c: Avoid implicit conversion of pointers to
booleans.
* lib/groupio.c: Free allocated buffers in case of failure.
2009-04-23 15:27:03 +05:30
|
|
|
/*@only@*/ /*@out@*/char **add_list (/*@returned@*/ /*@only@*/char **list, const char *member)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:15:23 +05:30
|
|
|
int i;
|
|
|
|
char **tmp;
|
2007-10-07 17:14:02 +05:30
|
|
|
|
2008-08-30 23:59:08 +05:30
|
|
|
assert (NULL != member);
|
2008-08-31 23:00:21 +05:30
|
|
|
assert (NULL != list);
|
2008-08-30 23:59:08 +05:30
|
|
|
|
2007-10-07 17:14:02 +05:30
|
|
|
/*
|
|
|
|
* Scan the list for the new name. Return the original list
|
|
|
|
* pointer if it is present.
|
|
|
|
*/
|
|
|
|
|
2008-05-24 19:39:35 +05:30
|
|
|
for (i = 0; list[i] != (char *) 0; i++) {
|
|
|
|
if (strcmp (list[i], member) == 0) {
|
2007-10-07 17:14:02 +05:30
|
|
|
return list;
|
2008-05-24 19:39:35 +05:30
|
|
|
}
|
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate a new list pointer large enough to hold all the
|
|
|
|
* old entries, and the new entries as well.
|
|
|
|
*/
|
|
|
|
|
|
|
|
tmp = (char **) xmalloc ((i + 2) * sizeof member);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy the original list to the new list, then append the
|
|
|
|
* new member and NULL terminate the result. This new list
|
|
|
|
* is returned to the invoker.
|
|
|
|
*/
|
|
|
|
|
2008-05-24 19:39:35 +05:30
|
|
|
for (i = 0; list[i] != (char *) 0; i++) {
|
2007-10-07 17:14:02 +05:30
|
|
|
tmp[i] = list[i];
|
2008-05-24 19:39:35 +05:30
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
|
2008-05-24 19:39:35 +05:30
|
|
|
tmp[i] = xstrdup (member);
|
|
|
|
tmp[i+1] = (char *) 0;
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* del_list - delete a member from a list of group members
|
|
|
|
*
|
|
|
|
* the array of member names is searched for the old member
|
|
|
|
* name, and if present it is deleted from a freshly allocated
|
|
|
|
* list of users.
|
|
|
|
*/
|
|
|
|
|
* libmisc/xgetXXbyYY.c, libmisc/myname.c, libmisc/getgr_nam_gid.c,
libmisc/salt.c, libmisc/list.c, libmisc/cleanup.c, src/login.c,
lib/getdef.h, lib/groupio.c, lib/getlong.c, lib/gshadow_.h,
lib/sgroupio.c, lib/shadowio.c, lib/pwio.c, lib/commonio.h,
lib/fputsx.c, lib/prototypes.h: Added splint annotations.
* lib/groupio.c: Avoid implicit conversion of pointers to
booleans.
* lib/groupio.c: Free allocated buffers in case of failure.
2009-04-23 15:27:03 +05:30
|
|
|
/*@only@*/ /*@out@*/char **del_list (/*@returned@*/ /*@only@*/char **list, const char *member)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:15:23 +05:30
|
|
|
int i, j;
|
|
|
|
char **tmp;
|
2007-10-07 17:14:02 +05:30
|
|
|
|
2008-08-30 23:59:08 +05:30
|
|
|
assert (NULL != member);
|
2008-08-31 23:00:21 +05:30
|
|
|
assert (NULL != list);
|
2008-08-30 23:59:08 +05:30
|
|
|
|
2007-10-07 17:14:02 +05:30
|
|
|
/*
|
|
|
|
* Scan the list for the old name. Return the original list
|
|
|
|
* pointer if it is not present.
|
|
|
|
*/
|
|
|
|
|
2008-05-24 19:39:35 +05:30
|
|
|
for (i = j = 0; list[i] != (char *) 0; i++) {
|
|
|
|
if (strcmp (list[i], member) != 0) {
|
2007-10-07 17:14:02 +05:30
|
|
|
j++;
|
2008-05-24 19:39:35 +05:30
|
|
|
}
|
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
|
2008-05-24 19:39:35 +05:30
|
|
|
if (j == i) {
|
2007-10-07 17:14:02 +05:30
|
|
|
return list;
|
2008-05-24 19:39:35 +05:30
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate a new list pointer large enough to hold all the
|
|
|
|
* old entries.
|
|
|
|
*/
|
|
|
|
|
|
|
|
tmp = (char **) xmalloc ((j + 1) * sizeof member);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy the original list except the deleted members to the
|
|
|
|
* new list, then NULL terminate the result. This new list
|
|
|
|
* is returned to the invoker.
|
|
|
|
*/
|
|
|
|
|
2008-05-24 19:39:35 +05:30
|
|
|
for (i = j = 0; list[i] != (char *) 0; i++) {
|
|
|
|
if (strcmp (list[i], member) != 0) {
|
|
|
|
tmp[j] = list[i];
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
tmp[j] = (char *) 0;
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
* libmisc/console.c, libmisc/motd.c, libmisc/setupenv.c,
libmisc/sulog.c, libmisc/hushed.c, libmisc/failure.c,
libmisc/loginprompt.c, libmisc/ttytype.c,
libmisc/pam_pass_non_interractive.c, src/userdel.c, src/login.c,
lib/commonio.c, lib/commonio.h: Fix some const issues.
* libmisc/motd.c: Avoid multi-statements lines.
* libmisc/motd.c: Support long MOTD_FILE.
* libmisc/list.c, lib/prototypes.h: Revert previous change.
dup_list and is_on_list are used with members as defined for the
group structure, and thus even if the list is not modified, the
list elements cannot be constant strings.
* libmisc/system.c: Avoid C++ comments.
* src/vipw.c: WITH_TCB cannot be tested inside a gettextized
string. Split the Usage string.
* lib/commonio.h: Re-indent.
2010-08-21 21:02:53 +05:30
|
|
|
/*
|
|
|
|
* Duplicate a list.
|
|
|
|
* The input list is not modified, but in order to allow the use of this
|
|
|
|
* function with list of members, the list elements are not enforced to be
|
|
|
|
* constant strings here.
|
|
|
|
*/
|
|
|
|
/*@only@*/ /*@out@*/char **dup_list (char *const *list)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char **tmp;
|
|
|
|
|
2008-08-31 23:00:21 +05:30
|
|
|
assert (NULL != list);
|
|
|
|
|
2008-08-30 23:59:08 +05:30
|
|
|
for (i = 0; NULL != list[i]; i++);
|
2007-10-07 17:14:02 +05:30
|
|
|
|
2007-10-07 17:15:23 +05:30
|
|
|
tmp = (char **) xmalloc ((i + 1) * sizeof (char *));
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
i = 0;
|
2008-08-30 23:59:08 +05:30
|
|
|
while (NULL != *list) {
|
2008-05-24 19:39:35 +05:30
|
|
|
tmp[i] = xstrdup (*list);
|
|
|
|
i++;
|
|
|
|
list++;
|
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
tmp[i] = (char *) 0;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
* libmisc/console.c, libmisc/motd.c, libmisc/setupenv.c,
libmisc/sulog.c, libmisc/hushed.c, libmisc/failure.c,
libmisc/loginprompt.c, libmisc/ttytype.c,
libmisc/pam_pass_non_interractive.c, src/userdel.c, src/login.c,
lib/commonio.c, lib/commonio.h: Fix some const issues.
* libmisc/motd.c: Avoid multi-statements lines.
* libmisc/motd.c: Support long MOTD_FILE.
* libmisc/list.c, lib/prototypes.h: Revert previous change.
dup_list and is_on_list are used with members as defined for the
group structure, and thus even if the list is not modified, the
list elements cannot be constant strings.
* libmisc/system.c: Avoid C++ comments.
* src/vipw.c: WITH_TCB cannot be tested inside a gettextized
string. Split the Usage string.
* lib/commonio.h: Re-indent.
2010-08-21 21:02:53 +05:30
|
|
|
/*
|
|
|
|
* Check if member is part of the input list
|
|
|
|
* The input list is not modified, but in order to allow the use of this
|
|
|
|
* function with list of members, the list elements are not enforced to be
|
|
|
|
* constant strings here.
|
|
|
|
*/
|
|
|
|
bool is_on_list (char *const *list, const char *member)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2008-08-30 23:59:08 +05:30
|
|
|
assert (NULL != member);
|
2008-08-31 23:00:21 +05:30
|
|
|
assert (NULL != list);
|
2008-08-30 23:59:08 +05:30
|
|
|
|
|
|
|
while (NULL != *list) {
|
2008-05-24 19:39:35 +05:30
|
|
|
if (strcmp (*list, member) == 0) {
|
2008-06-09 23:43:52 +05:30
|
|
|
return true;
|
2008-05-24 19:39:35 +05:30
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
list++;
|
|
|
|
}
|
2008-08-30 23:59:08 +05:30
|
|
|
|
2008-06-09 23:43:52 +05:30
|
|
|
return false;
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* comma_to_list - convert comma-separated list to (char *) array
|
|
|
|
*/
|
|
|
|
|
* libmisc/xgetXXbyYY.c, libmisc/myname.c, libmisc/getgr_nam_gid.c,
libmisc/salt.c, libmisc/list.c, libmisc/cleanup.c, src/login.c,
lib/getdef.h, lib/groupio.c, lib/getlong.c, lib/gshadow_.h,
lib/sgroupio.c, lib/shadowio.c, lib/pwio.c, lib/commonio.h,
lib/fputsx.c, lib/prototypes.h: Added splint annotations.
* lib/groupio.c: Avoid implicit conversion of pointers to
booleans.
* lib/groupio.c: Free allocated buffers in case of failure.
2009-04-23 15:27:03 +05:30
|
|
|
/*@only@*/char **comma_to_list (const char *comma)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:15:23 +05:30
|
|
|
char *members;
|
|
|
|
char **array;
|
|
|
|
int i;
|
* libmisc/console.c, libmisc/motd.c, libmisc/setupenv.c,
libmisc/sulog.c, libmisc/hushed.c, libmisc/failure.c,
libmisc/loginprompt.c, libmisc/ttytype.c,
libmisc/pam_pass_non_interractive.c, src/userdel.c, src/login.c,
lib/commonio.c, lib/commonio.h: Fix some const issues.
* libmisc/motd.c: Avoid multi-statements lines.
* libmisc/motd.c: Support long MOTD_FILE.
* libmisc/list.c, lib/prototypes.h: Revert previous change.
dup_list and is_on_list are used with members as defined for the
group structure, and thus even if the list is not modified, the
list elements cannot be constant strings.
* libmisc/system.c: Avoid C++ comments.
* src/vipw.c: WITH_TCB cannot be tested inside a gettextized
string. Split the Usage string.
* lib/commonio.h: Re-indent.
2010-08-21 21:02:53 +05:30
|
|
|
char *cp;
|
* libmisc/xgetXXbyYY.c, libmisc/myname.c, libmisc/getgr_nam_gid.c,
libmisc/salt.c, libmisc/list.c, libmisc/cleanup.c, src/login.c,
lib/getdef.h, lib/groupio.c, lib/getlong.c, lib/gshadow_.h,
lib/sgroupio.c, lib/shadowio.c, lib/pwio.c, lib/commonio.h,
lib/fputsx.c, lib/prototypes.h: Added splint annotations.
* lib/groupio.c: Avoid implicit conversion of pointers to
booleans.
* lib/groupio.c: Free allocated buffers in case of failure.
2009-04-23 15:27:03 +05:30
|
|
|
char *cp2;
|
2007-10-07 17:14:02 +05:30
|
|
|
|
2008-08-30 23:59:08 +05:30
|
|
|
assert (NULL != comma);
|
|
|
|
|
2007-10-07 17:14:02 +05:30
|
|
|
/*
|
|
|
|
* Make a copy since we are going to be modifying the list
|
|
|
|
*/
|
|
|
|
|
|
|
|
members = xstrdup (comma);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Count the number of commas in the list
|
|
|
|
*/
|
|
|
|
|
2008-05-24 19:39:35 +05:30
|
|
|
for (cp = members, i = 0;; i++) {
|
|
|
|
cp2 = strchr (cp, ',');
|
|
|
|
if (NULL != cp2) {
|
2007-10-07 17:14:02 +05:30
|
|
|
cp = cp2 + 1;
|
2008-05-24 19:39:35 +05:30
|
|
|
} else {
|
2007-10-07 17:14:02 +05:30
|
|
|
break;
|
2008-05-24 19:39:35 +05:30
|
|
|
}
|
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
/*
|
|
|
|
* Add 2 - one for the ending NULL, the other for the last item
|
|
|
|
*/
|
|
|
|
|
|
|
|
i += 2;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate the array we're going to store the pointers into.
|
|
|
|
*/
|
|
|
|
|
|
|
|
array = (char **) xmalloc (sizeof (char *) * i);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Empty list is special - 0 members, not 1 empty member. --marekm
|
|
|
|
*/
|
|
|
|
|
2008-05-24 19:39:35 +05:30
|
|
|
if ('\0' == *members) {
|
2007-10-07 17:14:02 +05:30
|
|
|
*array = (char *) 0;
|
Fix covscan RESOURCE_LEAK
Error: RESOURCE_LEAK (CWE-772): [#def1]
shadow-4.8.1/lib/commonio.c:320: alloc_fn: Storage is returned from allocation function "fopen_set_perms".
shadow-4.8.1/lib/commonio.c:320: var_assign: Assigning: "bkfp" = storage returned from "fopen_set_perms(backup, "w", &sb)".
shadow-4.8.1/lib/commonio.c:329: noescape: Resource "bkfp" is not freed or pointed-to in "putc".
shadow-4.8.1/lib/commonio.c:334: noescape: Resource "bkfp" is not freed or pointed-to in "fflush".
shadow-4.8.1/lib/commonio.c:339: noescape: Resource "bkfp" is not freed or pointed-to in "fileno".
shadow-4.8.1/lib/commonio.c:342: leaked_storage: Variable "bkfp" going out of scope leaks the storage it points to.
340| || (fclose (bkfp) != 0)) {
341| /* FIXME: unlink the backup file? */
342|-> return -1;
343| }
344|
Error: RESOURCE_LEAK (CWE-772): [#def2]
shadow-4.8.1/libmisc/addgrps.c:69: alloc_fn: Storage is returned from allocation function "malloc".
shadow-4.8.1/libmisc/addgrps.c:69: var_assign: Assigning: "grouplist" = storage returned from "malloc(i * 4UL)".
shadow-4.8.1/libmisc/addgrps.c:73: noescape: Resource "grouplist" is not freed or pointed-to in "getgroups". [Note: The source code implementation of the function has been overridden by a builtin model.]
shadow-4.8.1/libmisc/addgrps.c:126: leaked_storage: Variable "grouplist" going out of scope leaks the storage it points to.
124| }
125|
126|-> return 0;
127| }
128| #else /* HAVE_SETGROUPS && !USE_PAM */
Error: RESOURCE_LEAK (CWE-772): [#def3]
shadow-4.8.1/libmisc/chowntty.c:62: alloc_fn: Storage is returned from allocation function "getgr_nam_gid".
shadow-4.8.1/libmisc/chowntty.c:62: var_assign: Assigning: "grent" = storage returned from "getgr_nam_gid(getdef_str("TTYGROUP"))".
shadow-4.8.1/libmisc/chowntty.c:98: leaked_storage: Variable "grent" going out of scope leaks the storage it points to.
96| */
97| #endif
98|-> }
99|
Error: RESOURCE_LEAK (CWE-772): [#def4]
shadow-4.8.1/libmisc/copydir.c:742: open_fn: Returning handle opened by "open". [Note: The source code implementation of the function has been overridden by a user model.]
shadow-4.8.1/libmisc/copydir.c:742: var_assign: Assigning: "ifd" = handle returned from "open(src, 0)".
shadow-4.8.1/libmisc/copydir.c:748: leaked_handle: Handle variable "ifd" going out of scope leaks the handle.
746| #ifdef WITH_SELINUX
747| if (set_selinux_file_context (dst, NULL) != 0) {
748|-> return -1;
749| }
750| #endif /* WITH_SELINUX */
Error: RESOURCE_LEAK (CWE-772): [#def5]
shadow-4.8.1/libmisc/copydir.c:751: open_fn: Returning handle opened by "open". [Note: The source code implementation of the function has been overridden by a user model.]
shadow-4.8.1/libmisc/copydir.c:751: var_assign: Assigning: "ofd" = handle returned from "open(dst, 577, statp->st_mode & 0xfffU)".
shadow-4.8.1/libmisc/copydir.c:752: noescape: Resource "ofd" is not freed or pointed-to in "fchown_if_needed".
shadow-4.8.1/libmisc/copydir.c:775: leaked_handle: Handle variable "ofd" going out of scope leaks the handle.
773| ) {
774| (void) close (ifd);
775|-> return -1;
776| }
777|
Error: RESOURCE_LEAK (CWE-772): [#def7]
shadow-4.8.1/libmisc/idmapping.c:188: alloc_fn: Storage is returned from allocation function "xmalloc".
shadow-4.8.1/libmisc/idmapping.c:188: var_assign: Assigning: "buf" = storage returned from "xmalloc(bufsize)".
shadow-4.8.1/libmisc/idmapping.c:188: var_assign: Assigning: "pos" = "buf".
shadow-4.8.1/libmisc/idmapping.c:213: noescape: Resource "buf" is not freed or pointed-to in "write".
shadow-4.8.1/libmisc/idmapping.c:219: leaked_storage: Variable "pos" going out of scope leaks the storage it points to.
shadow-4.8.1/libmisc/idmapping.c:219: leaked_storage: Variable "buf" going out of scope leaks the storage it points to.
217| }
218| close(fd);
219|-> }
Error: RESOURCE_LEAK (CWE-772): [#def8]
shadow-4.8.1/libmisc/list.c:211: alloc_fn: Storage is returned from allocation function "xstrdup".
shadow-4.8.1/libmisc/list.c:211: var_assign: Assigning: "members" = storage returned from "xstrdup(comma)".
shadow-4.8.1/libmisc/list.c:217: var_assign: Assigning: "cp" = "members".
shadow-4.8.1/libmisc/list.c:218: noescape: Resource "cp" is not freed or pointed-to in "strchr".
shadow-4.8.1/libmisc/list.c:244: leaked_storage: Variable "cp" going out of scope leaks the storage it points to.
shadow-4.8.1/libmisc/list.c:244: leaked_storage: Variable "members" going out of scope leaks the storage it points to.
242| if ('\0' == *members) {
243| *array = (char *) 0;
244|-> return array;
245| }
246|
Error: RESOURCE_LEAK (CWE-772): [#def11]
shadow-4.8.1/libmisc/myname.c:61: alloc_fn: Storage is returned from allocation function "xgetpwnam".
shadow-4.8.1/libmisc/myname.c:61: var_assign: Assigning: "pw" = storage returned from "xgetpwnam(cp)".
shadow-4.8.1/libmisc/myname.c:67: leaked_storage: Variable "pw" going out of scope leaks the storage it points to.
65| }
66|
67|-> return xgetpwuid (ruid);
68| }
69|
Error: RESOURCE_LEAK (CWE-772): [#def12]
shadow-4.8.1/libmisc/user_busy.c:260: alloc_fn: Storage is returned from allocation function "opendir".
shadow-4.8.1/libmisc/user_busy.c:260: var_assign: Assigning: "task_dir" = storage returned from "opendir(task_path)".
shadow-4.8.1/libmisc/user_busy.c:262: noescape: Resource "task_dir" is not freed or pointed-to in "readdir".
shadow-4.8.1/libmisc/user_busy.c:278: leaked_storage: Variable "task_dir" going out of scope leaks the storage it points to.
276| _("%s: user %s is currently used by process %d\n"),
277| Prog, name, pid);
278|-> return 1;
279| }
280| }
Error: RESOURCE_LEAK (CWE-772): [#def20]
shadow-4.8.1/src/newgrp.c:162: alloc_fn: Storage is returned from allocation function "xgetspnam".
shadow-4.8.1/src/newgrp.c:162: var_assign: Assigning: "spwd" = storage returned from "xgetspnam(pwd->pw_name)".
shadow-4.8.1/src/newgrp.c:234: leaked_storage: Variable "spwd" going out of scope leaks the storage it points to.
232| }
233|
234|-> return;
235|
236| failure:
Error: RESOURCE_LEAK (CWE-772): [#def21]
shadow-4.8.1/src/passwd.c:530: alloc_fn: Storage is returned from allocation function "xstrdup".
shadow-4.8.1/src/passwd.c:530: var_assign: Assigning: "cp" = storage returned from "xstrdup(crypt_passwd)".
shadow-4.8.1/src/passwd.c:551: noescape: Resource "cp" is not freed or pointed-to in "strlen".
shadow-4.8.1/src/passwd.c:554: noescape: Resource "cp" is not freed or pointed-to in "strcat". [Note: The source code implementation of the function has been overridden by a builtin model.]
shadow-4.8.1/src/passwd.c:555: overwrite_var: Overwriting "cp" in "cp = newpw" leaks the storage that "cp" points to.
553| strcpy (newpw, "!");
554| strcat (newpw, cp);
555|-> cp = newpw;
556| }
557| return cp;
2021-06-14 16:09:48 +05:30
|
|
|
free (members);
|
2007-10-07 17:14:02 +05:30
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now go walk that list all over again, this time building the
|
|
|
|
* array of pointers.
|
|
|
|
*/
|
|
|
|
|
2007-10-07 17:15:23 +05:30
|
|
|
for (cp = members, i = 0;; i++) {
|
2007-10-07 17:14:02 +05:30
|
|
|
array[i] = cp;
|
2008-05-24 19:39:35 +05:30
|
|
|
cp2 = strchr (cp, ',');
|
|
|
|
if (NULL != cp2) {
|
|
|
|
*cp2 = '\0';
|
|
|
|
cp2++;
|
2007-10-07 17:14:02 +05:30
|
|
|
cp = cp2;
|
|
|
|
} else {
|
|
|
|
array[i + 1] = (char *) 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the new array of pointers
|
|
|
|
*/
|
|
|
|
|
|
|
|
return array;
|
|
|
|
}
|
2008-05-24 19:39:35 +05:30
|
|
|
|