Skip to content

Commit

Permalink
Check offset before accessing task name property (microsoft#180)
Browse files Browse the repository at this point in the history
* Check offset before accessing task name property

* Update nuspecs
  • Loading branch information
swannman authored Sep 22, 2021
1 parent 9eb5225 commit ac27477
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion O365.Security.Native.ETW.Debug.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Microsoft.O365.Security.Native.ETW Debug is a managed wrapper around the krabsetw ETW library. This is the Debug build.</description>
<summary>Microsoft.O365.Security.Native.ETW Debug is a managed wrapper around the krabsetw ETW library. This is the Debug build.</summary>
<releaseNotes>Do not specify start time when starting trace session.</releaseNotes>
<releaseNotes>Do not specify start time when starting trace session. Check offset before accessing task name property.</releaseNotes>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<language />
<tags>ETW krabs managed cppcli</tags>
Expand Down
2 changes: 1 addition & 1 deletion O365.Security.Native.ETW.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Microsoft.O365.Security.Native.ETW is a managed wrapper around the krabsetw ETW library.</description>
<summary>Microsoft.O365.Security.Native.ETW is a managed wrapper around the krabsetw ETW library.</summary>
<releaseNotes>Do not specify start time when starting trace session.</releaseNotes>
<releaseNotes>Do not specify start time when starting trace session. Check offset before accessing task name property.</releaseNotes>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<language />
<tags>ETW krabs managed cppcli</tags>
Expand Down
11 changes: 8 additions & 3 deletions krabs/krabs/schema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,14 @@ namespace krabs {

inline const wchar_t *schema::task_name() const
{
return reinterpret_cast<const wchar_t*>(
reinterpret_cast<const char*>(pSchema_) +
pSchema_->TaskNameOffset);
if (pSchema_->TaskNameOffset != 0) {
return reinterpret_cast<const wchar_t*>(
reinterpret_cast<const char*>(pSchema_) +
pSchema_->TaskNameOffset);
}
else {
return L"";
}
}

inline DECODING_SOURCE schema::decoding_source() const
Expand Down
2 changes: 1 addition & 1 deletion krabsetw.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Krabs ETW provides a modern C++ wrapper around the low-level ETW trace consumption functions</description>
<summary>Krabs ETW provides a modern C++ wrapper around the low-level ETW trace consumption functions</summary>
<releaseNotes>Do not specify start time when starting trace session.</releaseNotes>
<releaseNotes>Do not specify start time when starting trace session. Check offset before accessing task name property.</releaseNotes>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<language />
<tags>ETW krabs krabsetw native headers cpp</tags>
Expand Down

0 comments on commit ac27477

Please sign in to comment.