Commit cc97ef0
committed
[lldb][Linux] Fix potential out of bounds read of pr_fname
llvm#157170 added code that
assigned pr_fname to another std::string member.
In the lines before, we copy pr_fname using assign with a max
length set to either the length of the string in pr_fname, or
the size of pr_fname. Which is 16 bytes.
struct ELFLinuxPrPsInfo {
<...>
char pr_fname[16];
The content of pr_fname can fill all 16 bytes, that's why
we need the limit.
This was not done for m_executable_name where it ended up
calling the assignment from char* operator which could
read on into the rest of the corefile in some cases.
Likely wouldn't crash for reading out of bounds, but you
would at least see some strange things in LLDB.
Fix this by copying the std::string we already made for
thread_data.name.1 parent 0a7a7d5 commit cc97ef0
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
952 | 952 | | |
953 | 953 | | |
954 | 954 | | |
955 | | - | |
| 955 | + | |
956 | 956 | | |
957 | 957 | | |
958 | 958 | | |
| |||
0 commit comments