From 978cb1f154ed53b141109c11960293c1cafb9a43 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 18 May 2014 00:56:37 +0200 Subject: [PATCH] WUtil: fix posible crash in 'wgethomedir' (Coverity #50070) As pointed by Coverity, if the user does not a an entry in the password file then the function would assume its home path to be "/" but still continue and later try to check for user->pw_dir which would dereference the NULL pointer. Signed-off-by: Christophe CURIS --- WINGs/findfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/WINGs/findfile.c b/WINGs/findfile.c index 42845d03..048731ec 100644 --- a/WINGs/findfile.c +++ b/WINGs/findfile.c @@ -57,6 +57,7 @@ char *wgethomedir() if (!user) { werror(_("could not get password entry for UID %i"), getuid()); home = "/"; + return home; } if (!user->pw_dir)