From 57badcf93ed86d3bd801db4260f926d660d85468 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 2 Sep 2020 20:41:59 -0400 Subject: [PATCH] deps: libuv: cherry-pick 0e6e8620 Original commit message: unix: don't use _POSIX_PATH_MAX Libuv was using _POSIX_PATH_MAX wrong. Bug introduced in commit b56d279b ("unix: do not require PATH_MAX to be defined") from September 2018. _POSIX_PATH_MAX is the minimum max path size guaranteed by POSIX, not the actual max path size of the system libuv runs on. _POSIX_PATH_MAX is always 256, the real max is often much bigger. This commit fixes buffer overruns when processing very long paths in uv_fs_readlink() and uv_fs_realpath() because libuv was not allocating enough memory to store the result. Fixes: https://github.com/libuv/libuv/issues/2965 PR-URL: https://github.com/libuv/libuv/pull/2966 Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/221 Reviewed-By: Richard Lau Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: Jameson Nash --- deps/uv/src/unix/internal.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h index 47f220000dcd73..82f7bc93d27bfd 100644 --- a/deps/uv/src/unix/internal.h +++ b/deps/uv/src/unix/internal.h @@ -61,9 +61,7 @@ # include #endif -#if defined(_POSIX_PATH_MAX) -# define UV__PATH_MAX _POSIX_PATH_MAX -#elif defined(PATH_MAX) +#if defined(PATH_MAX) # define UV__PATH_MAX PATH_MAX #else # define UV__PATH_MAX 8192