Browse Source

Don't crash when installing a service.

install_service() calls edit_service() with a null username, causing
well_known_username() to segfault.

Thanks Czenda Czendov.
Iain Patterson 8 years ago
parent
commit
f05bb55303
1 changed files with 1 additions and 0 deletions
  1. 1 0
      account.cpp

+ 1 - 0
account.cpp

@@ -166,6 +166,7 @@ const TCHAR *well_known_sid(SID *sid) {
 }
 
 const TCHAR *well_known_username(const TCHAR *username) {
+  if (! username) return NSSM_LOCALSYSTEM_ACCOUNT;
   if (str_equiv(username, NSSM_LOCALSYSTEM_ACCOUNT)) return NSSM_LOCALSYSTEM_ACCOUNT;
   SID *sid;
   int r = username_sid(username, &sid);