Fix #81420: ZipArchive::extractTo extracts outside of destination

We need to properly detect and handle absolute paths in a portable way.
This commit is contained in:
Christoph M. Becker 2021-09-06 17:42:46 +02:00 committed by Stanislav Malyshev
parent 521bd7ce15
commit df2ceac25a
No known key found for this signature in database
GPG key ID: 94B3CB48C3ECA219
3 changed files with 26 additions and 2 deletions

View file

@ -106,8 +106,8 @@ static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */
return NULL;
}
if (IS_SLASH(path[0])) {
return path + 1;
if (IS_ABSOLUTE_PATH(path, path_len)) {
return path + COPY_WHEN_ABSOLUTE(path) + 1;
}
i = path_len;