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 13
13
#include < compat/compat.h>
14
14
#include < compat/cpuid.h>
15
15
#include < crypto/sha512.h>
16
+ #include < span.h>
16
17
#include < support/cleanse.h>
17
18
#include < util/time.h>
18
19
@@ -357,10 +358,19 @@ void RandAddStaticEnv(CSHA512& hasher)
357
358
hasher << &hasher << &RandAddStaticEnv << &malloc << &errno << &environ;
358
359
359
360
// 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
360
369
char hname[256 ];
361
370
if (gethostname (hname, 256 ) == 0 ) {
362
371
hasher.Write ((const unsigned char *)hname, strnlen (hname, 256 ));
363
372
}
373
+ #endif
364
374
365
375
#if HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS
366
376
// Network interfaces
You can’t perform that action at this time.
0 commit comments