Skip to content

Commit

Permalink
Fix unsafe type cast and CRT call (open-telemetry#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored Jan 15, 2021
1 parent 8702a10 commit bcfcc82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class ETWProvider
EVENT_DESCRIPTOR evtDescriptor;
EventDescCreate(&evtDescriptor, 0, 0x1, 0, 0, 0, 0, 0);
EVENT_DATA_DESCRIPTOR evtData[1];
EventDataDescCreate(&evtData[0], v.data(), v.size());
EventDataDescCreate(&evtData[0], v.data(), static_cast<ULONG>(v.size()));

auto writeResponse = EventWrite(providerData.providerHandle, &evtDescriptor, 1, evtData);

Expand Down
8 changes: 4 additions & 4 deletions exporters/etw/include/opentelemetry/exporters/etw/uuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ struct UUID
unsigned int p1, p2, p3, p4, p5, p6, p7, p8, p9, p10;
if (
// Parse input with dashes
(11 == sscanf(str, "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", &p0, &p1, &p2, &p3,
&p4, &p5, &p6, &p7, &p8, &p9, &p10)) ||
(11 == sscanf_s(str, "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", &p0, &p1, &p2,
&p3, &p4, &p5, &p6, &p7, &p8, &p9, &p10)) ||
// Parse input without dashes
(11 == sscanf(str, "%08lX%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X", &p0, &p1, &p2, &p3, &p4,
&p5, &p6, &p7, &p8, &p9, &p10)))
(11 == sscanf_s(str, "%08lX%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X", &p0, &p1, &p2, &p3,
&p4, &p5, &p6, &p7, &p8, &p9, &p10)))
{
Data1 = static_cast<uint32_t>(p0);
Data2 = static_cast<uint16_t>(p1);
Expand Down

0 comments on commit bcfcc82

Please sign in to comment.