This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Remove unnecessary locking when reading iconv configuration [BZ #22062]
On 10/17/18 8:19 AM, Adhemerval Zanella wrote:
>
>
> On 16/10/2018 11:23, Arjun Shankar wrote:
>> - }
>> + /* No user-defined path. Make a modifiable copy of the
>> + default path. */
>> + gconv_path = strdupa (default_gconv_path);
>> + gconv_path_len = sizeof (default_gconv_path);
>> + cwd = NULL;
>> + cwdlen = 0;
>> + }
>> + else
>> + {
>> + /* Append the default path to the user-defined path. */
>> + size_t user_len = strlen (__gconv_path_envvar);
>> +
>> + gconv_path_len = user_len + 1 + sizeof (default_gconv_path);
>> + gconv_path = alloca (gconv_path_len);
>> + __mempcpy (__mempcpy (__mempcpy (gconv_path, __gconv_path_envvar,
>> + user_len),
>> + ":", 1),
>> + default_gconv_path, sizeof (default_gconv_path));
>> + cwd = __getcwd (NULL, 0);
>> + cwdlen = __glibc_unlikely (cwd == NULL) ? 0 : strlen (cwd);
>
> It this alloca really necessary? Can't we get rid of on along with fix (same
> for other cases including strdupa)?
No. Not in the same fix please. This is what Florian is talking about, there
are buffer management issues here, but we need to handle them distinctly from
the P&C issue, which should be the *only* thing changing in this patch.
--
Cheers,
Carlos.