From: Steve Harter Date: Thu, 1 Feb 2018 19:34:27 +0000 (-0600) Subject: Fix issue with standalone exe name length >64 (dotnet/core-setup#3659) X-Git-Tag: submit/tizen/20210909.063632~11032^2~905 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90baaed1f9caaf9fd886939c0574e09c81e8ee7b;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix issue with standalone exe name length >64 (dotnet/core-setup#3659) Commit migrated from https://github.com/dotnet/core-setup/commit/9e84fbca526bee41952c3a059a47a05a7de539bb --- diff --git a/src/installer/corehost/corehost.cpp b/src/installer/corehost/corehost.cpp index 782db6c..97972f9 100644 --- a/src/installer/corehost/corehost.cpp +++ b/src/installer/corehost/corehost.cpp @@ -39,12 +39,15 @@ bool is_exe_enabled_for_execution(const pal::string_t& own_path) { constexpr int EMBED_SZ = sizeof(EMBED_HASH_FULL_UTF8) / sizeof(EMBED_HASH_FULL_UTF8[0]); constexpr int EMBED_MAX = (EMBED_SZ > 1025 ? EMBED_SZ : 1025); // 1024 DLL name length, 1 NUL - static const char embed[EMBED_MAX] = EMBED_HASH_FULL_UTF8; // series of NULs followed by embed hash string + + // Contains the embed hash value at compile time or the managed DLL name replaced by "dotnet build". + // Must not be 'const' because std::string(&embed[0]) below would bind to a const string ctor plus length + // where length is determined at compile time (=64) instead of the actual length of the string at runtime. + static char embed[EMBED_MAX] = EMBED_HASH_FULL_UTF8; // series of NULs followed by embed hash string + static const char hi_part[] = EMBED_HASH_HI_PART_UTF8; static const char lo_part[] = EMBED_HASH_LO_PART_UTF8; - // At this point the "embed" variable may contain the embed hash value specified above at compile time - // or the managed DLL name replaced by "dotnet build". std::string binding(&embed[0]); pal::string_t pal_binding; if (!pal::utf8_palstring(binding, &pal_binding))