[patch] Fix path length overflow in realpath (BZ#22786)
Andreas Schwab
schwab@suse.de
Tue Apr 10 08:08:00 GMT 2018
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."
More information about the Libc-alpha
mailing list