[PATCH 5/6] gdb: prepend comp_dir to symtab name in buildsym_compunit

Eli Zaretskii eliz@gnu.org
Thu Apr 7 06:09:16 GMT 2022


> Date: Wed,  6 Apr 2022 21:51:58 -0400
> From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
> 
> +  if (!IS_ABSOLUTE_PATH (name) && m_comp_dir != nullptr)
> +    {
> +      name_copy = string_printf ("%s/%s", m_comp_dir.get (), name);

Is it really the best idea to concatenate the directory and the file
this way?  What is 'name' includes "./" or "../" components? what if
m_comp_dir ends in a slash or a backslash (for example, if it's just
"/")? etc. etc.

Shouldn't we use a more sophisticated API here that has some knowledge
about the semantics of file names?

Thanks.


More information about the Gdb-patches mailing list