Bug 20817 - dlerror uses strerror in a thread-unsafe manner
Summary: dlerror uses strerror in a thread-unsafe manner
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: dynamic-link (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-14 12:34 UTC by Florian Weimer
Modified: 2016-11-14 13:19 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Weimer 2016-11-14 12:34:12 UTC
dlerror does this:

        n = __asprintf (&buf, "%s%s%s: %s",
                        result->objname,
                        result->objname[0] == '\0' ? "" : ": ",
                        _(result->errstring),
                        strerror (result->errcode));

strerror is not thread-safe, and the could should assign errno and use %m.
Comment 1 Andreas Schwab 2016-11-14 13:19:40 UTC
As long as the errcode is in range the call is thread-safe.