Skip to content

Commit

Permalink
deps: libuv: cherry-pick 0e6e8620
Browse files Browse the repository at this point in the history
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: libuv/libuv#2965
PR-URL: libuv/libuv#2966
Backport-PR-URL: nodejs-private/node-private#221
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jameson Nash <[email protected]>
  • Loading branch information
cjihrig authored and BethGriggs committed Sep 8, 2020
1 parent f38bcc2 commit 57badcf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions deps/uv/src/unix/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@
# include <AvailabilityMacros.h>
#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
Expand Down

0 comments on commit 57badcf

Please sign in to comment.