Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid null pointer dereference in chdir_homedir()
Return if pw is NULL, to avoid dereferencing it at pw->pw_dir.
  • Loading branch information
xiw committed Sep 27, 2012
1 parent 815aff9 commit f0d9cb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/frontend/mosh-server.cc
Expand Up @@ -747,7 +747,7 @@ void chdir_homedir( void )
struct passwd *pw = getpwuid( geteuid() );
if ( pw == NULL ) {
perror( "getpwuid" );
/* non-fatal */
return; /* non-fatal */
}

if ( chdir( pw->pw_dir ) < 0 ) {
Expand Down

0 comments on commit f0d9cb3

Please sign in to comment.