[Lldb-commits] [lldb] [lldb] Correct format specifier for sscanf to prevent buffer overflow (NFC) (PR #94783)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 24 04:33:38 PDT 2024
https://github.com/labath commented:
The field this is consuming is actually 17 bytes long, because the process name is in parenthesis. I suspect this will cause the function to reject any process whose name is longer than 13 characters.
The name field is actually quite hard to parse this way since it can contain any character (esp. parenthesis and spaces). Now, we could devise an algorithm to do that, but since the code is later opening `/proc/$PID/status` anyway, and `status` contains a superset of information, I think it'd be best to just delete this code and extract the information we want from there.
`status` parsing code also uses more modern and less error prone patterns.
https://github.com/llvm/llvm-project/pull/94783
More information about the lldb-commits
mailing list