Skip to content

Commit 6e9e933

Browse files
committed
Altered the environment variable read to accept any value, rather than just "true".
Added a reference to the github issue.
1 parent 285b77e commit 6e9e933

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/NetMQ/Core/Utils/OpCode.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ internal static class Opcode
1111

1212
public static bool Open()
1313
{
14-
//Look for an environment variable: "NETQM_SUPPRESS_RDTSC" with a value of "TRUE"
14+
//Look for an environment variable: "NETQM_SUPPRESS_RDTSC" with any value
1515
// The application can set this environment variable when this code is running in a system where
1616
// it is not desirable to read the processor's time stamp counter.
1717
// While this is supported in modern CPUs, the technique used for allocating executable memory, copying OP Code
1818
// for the read of the time stamp and invoking the OP Code can be detected as Malware by some anti-virus vendors.
19-
var val = Environment.GetEnvironmentVariable("NETQM_SUPPRESS_RDTSC");
20-
if ("TRUE".Equals(val, StringComparison.OrdinalIgnoreCase))
19+
// https://github.com/zeromq/netmq/issues/1071
20+
string val = Environment.GetEnvironmentVariable("NETQM_SUPPRESS_RDTSC");
21+
if (!string.IsNullOrEmpty(val))
2122
return false;
2223
#if NETSTANDARD1_1_OR_GREATER || NET471_OR_GREATER
2324
if (RuntimeInformation.ProcessArchitecture != Architecture.X86 &&

0 commit comments

Comments
 (0)