diff options
author | 2012-09-26 22:27:24 -0400 | |
---|---|---|
committer | 2012-09-26 22:27:24 -0400 | |
commit | f0d9cb3db3b419f84893a6efb6bf136ed2b4d120 (patch) | |
tree | 06e11bce6831044283a907a1de0f28fa31344db1 | |
parent | 815aff9a735623dd05d7eccf9d07089cd19fe318 (diff) |
Avoid null pointer dereference in chdir_homedir()
Return if pw is NULL, to avoid dereferencing it at pw->pw_dir.
-rw-r--r-- | src/frontend/mosh-server.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index 711bba7..965d67a 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -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 ) { |