[Lldb-commits] [lldb] r324156 - Fix a copy of a fixed length, possibly non-nul terminated, string

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 5 09:43:21 PST 2018


On Fri, Feb 2, 2018 at 2:48 PM, Jason Molenda via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
> Author: jmolenda
> Date: Fri Feb  2 14:48:45 2018
> New Revision: 324156
>
> URL: http://llvm.org/viewvc/llvm-project?rev=324156&view=rev
> Log:
> Fix a copy of a fixed length, possibly non-nul terminated, string
> into a std::string so we don't run off the end of the array when
> there is no nul byte in ProcessElfCore::parseLinuxNotes.
> Found with ASAN testing.
>
> <rdar://problem/37134319>
>
> Differential revision: https://reviews.llvm.org/D42828
>
> Modified:
>     lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
>
> Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=324156&r1=324155&r2=324156&view=diff
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
> +++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Fri Feb  2 14:48:45 2018
> @@ -665,7 +665,7 @@ llvm::Error ProcessElfCore::parseLinuxNo
>        Status status = prpsinfo.Parse(note.data, arch);
>        if (status.Fail())
>          return status.ToError();
> -      thread_data.name = prpsinfo.pr_fname;
> +      thread_data.name.assign (prpsinfo.pr_fname, strnlen (prpsinfo.pr_fname, sizeof (prpsinfo.pr_fname)));

This seems to exceed 80 lines, can you please `clang-format` it for consistency?

Thanks!

--
Davide


More information about the lldb-commits mailing list