Skip to content

Commit 09e0f1e

Browse files
authored
[LLDB]Fix buffer-over-flow bug introduced in 157170 (#159588)
If `pr_name` is longer than 16, it would be a non-null terminated string. Assigning it to `std::string m_executable_name` would cause an overflow read. Instead, just copy the name from thread_data.name. To repro, run the `elf-core/TestLinuxCore.py` with asan (Question: why is the new variable needed in the first place? can't the thread_data.name be used?)
1 parent 4f72abd commit 09e0f1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ llvm::Error ProcessElfCore::parseLinuxNotes(llvm::ArrayRef<CoreNote> notes) {
952952
return status.ToError();
953953
thread_data.name.assign (prpsinfo.pr_fname, strnlen (prpsinfo.pr_fname, sizeof (prpsinfo.pr_fname)));
954954
SetID(prpsinfo.pr_pid);
955-
m_executable_name = prpsinfo.pr_fname;
955+
m_executable_name = thread_data.name;
956956
break;
957957
}
958958
case ELF::NT_SIGINFO: {

0 commit comments

Comments
 (0)