mirror of
https://github.com/php/php-src.git
synced 2024-11-29 04:46:07 +08:00
Likely fix for bug #33140
This commit is contained in:
parent
f3f97394b2
commit
87d6f497f7
@ -1079,18 +1079,24 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mod
|
||||
char *e, *buf;
|
||||
struct stat sb;
|
||||
int dir_len = strlen(dir);
|
||||
int offset = 0;
|
||||
|
||||
buf = estrndup(dir, dir_len);
|
||||
e = buf + dir_len;
|
||||
|
||||
if ((p = memchr(buf, DEFAULT_SLASH, dir_len))) {
|
||||
offset = p - buf + 1;
|
||||
}
|
||||
|
||||
/* find a top level directory we need to create */
|
||||
while ((p = strrchr(buf, DEFAULT_SLASH))) {
|
||||
while ((p = strrchr(buf + offset, DEFAULT_SLASH))) {
|
||||
*p = '\0';
|
||||
if (VCWD_STAT(buf, &sb) == 0) {
|
||||
*p = DEFAULT_SLASH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (p == buf) {
|
||||
ret = php_mkdir(dir, mode TSRMLS_CC);
|
||||
} else if (!(ret = php_mkdir(buf, mode TSRMLS_CC))) {
|
||||
|
Loading…
Reference in New Issue
Block a user