Skip to content

Instantly share code, notes, and snippets.

@rlerdorf
Created March 10, 2021 16:59
Show Gist options
  • Save rlerdorf/3f1327724e9110259a168264a3fdb2ef to your computer and use it in GitHub Desktop.
Save rlerdorf/3f1327724e9110259a168264a3fdb2ef to your computer and use it in GitHub Desktop.
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index 220e14b675..7e94548a00 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -1153,10 +1153,13 @@ retry_reparse_tag_cloud:
memcpy(tmp, path, len+1);
if (save && S_ISLNK(st.st_mode)) {
- if (++(*ll) > LINK_MAX || (j = (size_t)php_sys_readlink(tmp, path, MAXPATHLEN)) == (size_t)-1) {
- /* too many links or broken symlinks */
- free_alloca(tmp, use_heap);
- return (size_t)-1;
+ if(memcmp(tmp, "/var/etsy/", sizeof("/var/etsy/") - 1) == 0) {
+ memcpy(path, tmp, len);
+ j = len + 1;
+ } else if (++(*ll) > LINK_MAX || (j = (size_t)php_sys_readlink(tmp, path, MAXPATHLEN)) == (size_t)-1) {
+ /* too many links or broken symlinks */
+ free_alloca(tmp, use_heap);
+ return (size_t)-1;
}
path[j] = 0;
if (IS_ABSOLUTE_PATH(path, j)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment