Skip to content

Commit

Permalink
Fix version parsing in Dataflow (#5263)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingosse authored Mar 7, 2024
1 parent 7b23886 commit 7bef2de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions tracer/src/Datadog.Tracer.Native/iast/dataflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ Dataflow::Dataflow(ICorProfilerInfo* profiler)
HRESULT hr = profiler->QueryInterface(__uuidof(ICorProfilerInfo3), (void**) &_profiler);
if (_profiler != nullptr)
{
WCHAR version[1024];
ULONG versionLength;
if (SUCCEEDED(_profiler->GetRuntimeInformation(nullptr, &m_runtimeType, nullptr, nullptr, nullptr, nullptr, 1024,
&versionLength, version)))
USHORT major;
USHORT minor;
USHORT build;

if (SUCCEEDED(_profiler->GetRuntimeInformation(nullptr, &m_runtimeType, &major, &minor, &build, nullptr, 0,
nullptr, nullptr)))
{
m_runtimeVersion = GetVersionInfo(version);
m_runtimeVersion = VersionInfo{major, minor, build, 0};
}
}
trace::Logger::Info("Dataflow::Dataflow -> Detected runtime version : ", m_runtimeVersion.ToString());
Expand Down
2 changes: 1 addition & 1 deletion tracer/src/Datadog.Tracer.Native/iast/iast_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static thread_local std::unordered_map<void *, bool> locked;
VersionInfo GetVersionInfo(const std::string& version)
{
auto v = version;
if (StartsWith(v, "V"))
if (StartsWith(v, "V") || StartsWith(v, "v"))
{
v = v.substr(1);
}
Expand Down

0 comments on commit 7bef2de

Please sign in to comment.