[PATCH] ld.so: Reject overly long LD_PRELOAD path elements
Florian Weimer
fweimer@redhat.com
Mon Jun 19 20:29:00 GMT 2017
On 06/19/2017 10:00 PM, Carlos O'Donell wrote:
> /* For SUID binaries, all glibc ports have limits, even though we want
> to avoid limits in the GNU operating system.
> For those operating systems that do not define such limits, we
> define them to an arbitrary but small value. The GNU/Hurd includes
> no such limits, but we define them for now as a security heuristic for
> SUID binaries. */
> #ifndef NAME_MAX
> #define NAME_MAX 4096
> #endif
We use 1024 for PATH_MAX in various places inside glibc already, so I'm
going to stick with that. NAME_MAX should be 255, I think. This is
what I'm going to check in:
/* Length limits for names and paths, to protect the dynamic linker,
particularly when __libc_enable_secure is active. */
#ifdef NAME_MAX
# define SECURE_NAME_LIMIT NAME_MAX
#else
# define SECURE_NAME_LIMIT 255
#endif
#ifdef PATH_MAX
# define SECURE_PATH_LIMIT PATH_MAX
#else
# define SECURE_PATH_LIMIT 1024
#endif
Thanks,
Florian
More information about the Libc-alpha
mailing list