File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1313#include < compat/compat.h>
1414#include < compat/cpuid.h>
1515#include < crypto/sha512.h>
16+ #include < span.h>
1617#include < support/cleanse.h>
1718#include < util/time.h>
1819
@@ -357,10 +358,19 @@ void RandAddStaticEnv(CSHA512& hasher)
357358 hasher << &hasher << &RandAddStaticEnv << &malloc << &errno << &environ;
358359
359360 // Hostname
361+ #ifdef WIN32
362+ constexpr DWORD max_size = MAX_COMPUTERNAME_LENGTH + 1 ;
363+ char hname[max_size];
364+ DWORD size = max_size;
365+ if (GetComputerNameA (hname, &size) != 0 ) {
366+ hasher.Write (UCharCast (hname), size);
367+ }
368+ #else
360369 char hname[256 ];
361370 if (gethostname (hname, 256 ) == 0 ) {
362371 hasher.Write ((const unsigned char *)hname, strnlen (hname, 256 ));
363372 }
373+ #endif
364374
365375#if HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS
366376 // Network interfaces
You can’t perform that action at this time.
0 commit comments