diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-06-17 19:40:25 +0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-06-26 10:04:31 -0300 |
commit | daf7b53a3c93e99ce66837e908984148fb9f11ee (patch) | |
tree | ebeaffc635c3e463725fcdc213d8a3f9670305a7 /login | |
parent | 21fbc0a19366f89638a30eef2b53c6d4baafdb88 (diff) | |
download | glibc-daf7b53a3c93e99ce66837e908984148fb9f11ee.zip glibc-daf7b53a3c93e99ce66837e908984148fb9f11ee.tar.gz glibc-daf7b53a3c93e99ce66837e908984148fb9f11ee.tar.bz2 |
elf: Port ldconfig away from stack-allocated paths
ldconfig was allocating PATH_MAX bytes on the stack for the library file
name. The issues with PATH_MAX usage are well documented [0][1]; even if
a program does not rely on paths being limited to PATH_MAX bytes,
allocating 4096 bytes on the stack for paths that are typically rather
short (strlen ("/lib64/libc.so.6") is 16) is wasteful and dangerous.
[0]: https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
[1]: https://eklitzke.org/path-max-is-tricky
Instead, make use of asprintf to dynamically allocate memory of just the
right size on the heap.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Diffstat (limited to 'login')
0 files changed, 0 insertions, 0 deletions