This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch] Fix path length overflow in realpath (BZ#22786)
- From: Andreas Schwab <schwab at suse dot de>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>
- Cc: GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Tue, 10 Apr 2018 10:08:49 +0200
- Subject: Re: [patch] Fix path length overflow in realpath (BZ#22786)
- References: <CALoOobOyeu6SM7DGPRqmHE6Y7BckFGmEFGeeFKDKjskL4EJDuA@mail.gmail.com> <CALoOobMWCHXYh-3rDeSfHauaOtpMmVMpv_obPA8Dk9ubTvfK=Q@mail.gmail.com>
On Apr 10 2018, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> + const size_t path_len = (size_t) INT_MAX + 1;
> + char *path = malloc (path_len);
> +
> + if (path == NULL)
> + {
> + printf ("malloc (%zu): %m\n", path_len);
> + return EXIT_FAILURE;
> + }
Trying to allocate a block of INT_MAX+1 is rather likely to fail on a
32-bit platform.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."