mirror of
https://github.com/zlib-ng/minizip-ng
synced 2026-08-25 14:26:08 -04:00
Add buffer overflow check in mz_os_read_symlink function #944
This commit is contained in:
parent
0fa77a3861
commit
9963dd30c5
2 changed files with 6 additions and 2 deletions
6
mz_os.c
6
mz_os.c
|
|
@ -329,8 +329,10 @@ int32_t mz_dir_has_unsafe_symlink(const char *path, const char *base_path) {
|
|||
/* Check if this existing path component is a symlink */
|
||||
if (mz_os_is_symlink(check_path) != MZ_OK)
|
||||
continue;
|
||||
if (mz_os_read_symlink(check_path, symlink_target, (int32_t)(path_len + 1)) != MZ_OK)
|
||||
continue;
|
||||
if (mz_os_read_symlink(check_path, symlink_target, (int32_t)(path_len + 1)) != MZ_OK) {
|
||||
err = MZ_EXIST_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Absolute symlink targets are not allowed */
|
||||
if (mz_os_is_dir_separator(symlink_target[0])) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue