]> git.ipfire.org Git - thirdparty/shadow.git/commit
src/usermod.c: update_group_file(): Fix RESOURCE_LEAK (CWE-772)
authorAlejandro Colomar <alx@kernel.org>
Thu, 16 May 2024 11:54:06 +0000 (13:54 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Mon, 20 May 2024 07:37:01 +0000 (09:37 +0200)
commit61964aa06b9e6e0643a6519f64290f18ac04867f
tree7973bed295468f97730ec5d860231fcab18f8823
parent81bc78ec5cdd59790bc7c591c9d1f66bd4d7b78e
src/usermod.c: update_group_file(): Fix RESOURCE_LEAK (CWE-772)

Report:
> shadow-4.15.0/src/usermod.c:734:3: alloc_fn: Storage is returned from allocation function "__gr_dup".
> shadow-4.15.0/src/usermod.c:734:3: var_assign: Assigning: "ngrp" = storage returned from "__gr_dup(grp)".
> shadow-4.15.0/src/usermod.c:815:1: leaked_storage: Variable "ngrp" going out of scope leaks the storage it points to.
> 813|                   gr_free(ngrp);
> 814|           }
> 815|-> }
> 816|
> 817|   #ifdef SHADOWGRP

Link: https://issues.redhat.com/browse/RHEL-35383
Reported-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/usermod.c