Skip to content

Commit 69ab397

Browse files
authored
Merge pull request #3081 from buttaface/fortify
Plugin: fix calling readlink() with a larger PATH_MAX
2 parents 9402945 + e5425cb commit 69ab397

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CoreFoundation/PlugIn.subproj/CFBundle_Resources.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ CF_PRIVATE _CFBundleVersion _CFBundleGetBundleVersionForURL(CFURLRef url) {
359359
if (CFStringGetFileSystemRepresentation(linkPath, linkPathCString, PATH_MAX) &&
360360
CFStringGetFileSystemRepresentation(bundlePath, bundlePathCString, PATH_MAX)) {
361361
// Leave room for a null terminator
362-
ssize_t len = readlink(linkPathCString, linkContentsCString, PATH_MAX - 1);
362+
ssize_t len = readlink(linkPathCString, linkContentsCString, CFMaxPathLength);
363363
// Make sure this is not an absolute link but a relative one
364364
if (len < 2 || (len > 1 && linkContentsCString[0] == '/')) {
365365
os_log_error(_CFBundleResourceLogger(), "`WrappedBundle` link too short or pointed outside bundle at %{public}@", url);

0 commit comments

Comments
 (0)