projects
/
platform
/
upstream
/
dotnet
/
runtime.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b5d044d
)
Fix write behind allocated memory in thread name setting (#34424)
author
Jan Vorlicek
<janvorli@microsoft.com>
Thu, 2 Apr 2020 00:57:02 +0000
(
02:57
+0200)
committer
GitHub
<noreply@github.com>
Thu, 2 Apr 2020 00:57:02 +0000
(
02:57
+0200)
The code in CorUnix::InternalSetThreadDescription is writing behind
the end of the allocated memory in case the name is shorter than 16
characters. That is causing memory heap corruption.
src/coreclr/src/pal/src/thread/thread.cpp
patch
|
blob
|
history
diff --git
a/src/coreclr/src/pal/src/thread/thread.cpp
b/src/coreclr/src/pal/src/thread/thread.cpp
index
1473601
..
159ef03
100644
(file)
--- a/
src/coreclr/src/pal/src/thread/thread.cpp
+++ b/
src/coreclr/src/pal/src/thread/thread.cpp
@@
-1666,7
+1666,10
@@
CorUnix::InternalSetThreadDescription(
// Null terminate early.
// pthread_setname_np only accepts up to 16 chars.
- nameBuf[15] = '\0';
+ if (nameSize > 15)
+ {
+ nameBuf[15] = '\0';
+ }
error = pthread_setname_np(pTargetThread->GetPThreadSelf(), nameBuf);