summaryrefslogtreecommitdiff
path: root/ext/phar/util.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-12-11 16:47:42 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-12-15 11:44:53 +0100
commita53d67ceac301cbd27c4f0f716d4fbcdb7db3407 (patch)
tree749d827e69f6abc2eec6d04bfbdfff5fde4f6305 /ext/phar/util.c
parentc0a1c2c5ee950b4f283945ac3c02b78dc75fa75c (diff)
downloadphp-git-a53d67ceac301cbd27c4f0f716d4fbcdb7db3407.tar.gz
Fix #77322: PharData::addEmptyDir('/') Possible integer overflow
`phar_path_check()` already strips a leading slash, so we must not attempt to strip the trailing slash from an now empty directory name. Closes GH-6508.
Diffstat (limited to 'ext/phar/util.c')
-rw-r--r--ext/phar/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/phar/util.c b/ext/phar/util.c
index 53982b0f85..354f0dbaac 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -567,7 +567,7 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, size_t fname_len, ch
} else {
etemp.flags = etemp.old_flags = PHAR_ENT_PERM_DEF_FILE;
}
- if (is_dir) {
+ if (is_dir && path_len) {
etemp.filename_len--; /* strip trailing / */
path_len--;
}