summaryrefslogtreecommitdiff
path: root/ext/session/mod_files.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-07-03 09:30:33 +0800
committerXinchen Hui <laruence@gmail.com>2016-07-03 09:30:33 +0800
commit6744737577bcbae4ff3d0082f23c9282758cacbb (patch)
treec14c0aee1c1d112ac99ced29a6b1f3a9300bfd76 /ext/session/mod_files.c
parentc9fa39da5eaf87a55cef75f8412ed07040a7b499 (diff)
downloadphp-git-6744737577bcbae4ff3d0082f23c9282758cacbb.tar.gz
Fixed bug #72531 (ps_files_cleanup_dir Buffer overflow)
Diffstat (limited to 'ext/session/mod_files.c')
-rw-r--r--ext/session/mod_files.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index b380cfe86b..64a6c47e00 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -294,6 +294,11 @@ static int ps_files_cleanup_dir(const char *dirname, zend_long maxlifetime)
dirname_len = strlen(dirname);
+ if (dirname_len >= MAXPATHLEN) {
+ php_error_docref(NULL, E_NOTICE, "ps_files_cleanup_dir: dirname(%s) is too long", dirname);
+ return (0);
+ }
+
/* Prepare buffer (dirname never changes) */
memcpy(buf, dirname, dirname_len);
buf[dirname_len] = PHP_DIR_SEPARATOR;