[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A minor fix in nl-langinfo
From: |
Ludovic Courtès |
Subject: |
Re: A minor fix in nl-langinfo |
Date: |
Wed, 13 Aug 2014 21:35:42 +0200 |
User-agent: |
Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux) |
Mark H Weaver <address@hidden> skribis:
> Mark H Weaver <address@hidden> writes:
>
>> address@hidden (Ludovic Courtès) writes:
>>
>>> Eli Zaretskii <address@hidden> skribis:
>>>
>>>> Sorry, that missed one more instance. Please use this patch instead.
>>>>
>>>> --- libguile/i18n.c~0 2014-08-08 17:05:57.262034100 +0300
>>>> +++ libguile/i18n.c 2014-08-10 17:20:52.073000000 +0300
>>>> @@ -1497,6 +1497,8 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinf
>>>> {
>>>> #ifdef USE_GNU_LOCALE_API
>>>> c_result = nl_langinfo_l (c_item, c_locale);
>>>> + if (c_result != NULL)
>>>> + c_result = strdup (c_result);
>>>> codeset = nl_langinfo_l (CODESET, c_locale);
>
> So, I think we have to copy 'codeset' also, because it is not used until
> after the locale mutex is released, at which point another thread could
> call 'nl_langinfo*' and overwrite the static buffer that 'codeset'
> points to.
Indeed.
> +static char *
> +copy_string_or_null (char *s)
const char *s
Fine with me!
Ludo’.