mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 11:18:43 +00:00
vtysh: Fix, guard against NULL pointer dereference
getpwuid() may fail returning a null value leaving subsequent code vulnerable to a null pointer dereference. Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com> Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com> Tested-by: NetDEF CI System <cisystem@netdef.org>
This commit is contained in:
parent
bfe15094c2
commit
6d128e1d78
@ -195,7 +195,11 @@ vtysh_auth (void)
|
|||||||
struct vtysh_user *user;
|
struct vtysh_user *user;
|
||||||
struct passwd *passwd;
|
struct passwd *passwd;
|
||||||
|
|
||||||
passwd = getpwuid (geteuid ());
|
if ((passwd = getpwuid (geteuid ())) == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "could not lookup user ID %d\n", (int) geteuid());
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
user = user_lookup (passwd->pw_name);
|
user = user_lookup (passwd->pw_name);
|
||||||
if (user && user->nopassword)
|
if (user && user->nopassword)
|
||||||
|
Loading…
Reference in New Issue
Block a user