From: Iain Patterson Date: Thu, 13 Feb 2014 18:52:55 +0000 (+0000) Subject: Don't crash when installing a service. X-Git-Tag: v2.22~10 X-Git-Url: http://git.iain.cx/?p=nssm.git;a=commitdiff_plain;h=f05bb553036cf067637ca20223065a8f652df90b 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. --- diff --git a/account.cpp b/account.cpp index 5e6523f..19dc66e 100644 --- a/account.cpp +++ b/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);