[PATCH v6] locale: memory leak in newlocale [BZ #25770]

Florian Weimer fweimer@redhat.com
Mon Jun 2 10:59:51 GMT 2025


* Dmitry Kovalenko:

> +  {
> +    char s[] = "LOCPATH=/usr/share/locale";
> +    int const r = putenv (s);
> +
> +    if (r != 0)
> +      {
> +        printf ("putenv failed: %m\n");
> +        exit (EXIT_FAILURE);

And this creates a use-after free bug.  You need to use the string
literal directly, or: static const char s[] = …

Thanks,
Florian



More information about the Libc-alpha mailing list