Skip to content

Commit f7e73fc

Browse files
Fix format-string mismatch in load_user_profile debug log
The debug3 on LoadUserProfileW failure had format "%s %S %d" (three specifiers) but only two arguments. %S consumed GetLastError()'s DWORD as a wide-string pointer and wcsnlen dereferenced it, crashing sshd-session post-auth. Only visible where LoadUserProfileW actually fails (e.g. WinPE, which has no user-profile service), so regular Windows was unaffected.
1 parent c55ef23 commit f7e73fc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

contrib/win32/win32compat/win32_usertoken_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ load_user_profile(HANDLE user_token, char* user)
432432
EnablePrivilege("SeBackupPrivilege", 1);
433433
EnablePrivilege("SeRestorePrivilege", 1);
434434
if (LoadUserProfileW(user_token, &profileInfo) == FALSE) {
435-
debug3("%s: LoadUserProfileW() failed for user %S with error %d.", __FUNCTION__, GetLastError());
435+
debug3("%s: LoadUserProfileW() failed for user %S with error %d.", __FUNCTION__, user_name, GetLastError());
436436
}
437437
EnablePrivilege("SeBackupPrivilege", 0);
438438
EnablePrivilege("SeRestorePrivilege", 0);

0 commit comments

Comments
 (0)