com php-src: Fixed bug #72531 (ps_files_cleanup_dir B uffer overflow): NEWS ext/session/mod_files.c

From: Date: Sun, 03 Jul 2016 01:30:33 +0000
Subject: com php-src: Fixed bug #72531 (ps_files_cleanup_dir B uffer overflow): NEWS ext/session/mod_files.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92732@lists.php.net to get a copy of this message
Commit: 6744737577bcbae4ff3d0082f23c9282758cacbb Author: Xinchen Hui <laruence@gmail.com> Sun, 3 Jul 2016 09:30:33 +0800 Parents: c9fa39da5eaf87a55cef75f8412ed07040a7b499 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6744737577bcbae4ff3d0082f23c9282758cacbb Log: Fixed bug #72531 (ps_files_cleanup_dir Buffer overflow) Bugs: https://bugs.php.net/72531 Changed paths: M NEWS M ext/session/mod_files.c Diff: diff --git a/NEWS b/NEWS index c8abefe..3e2be90 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,9 @@ PHP NEWS . Fixed bug #72306 (Heap overflow through proc_open and $env parameter). (Laruence) +- Session: + . Fixed bug #72531 (ps_files_cleanup_dir Buffer overflow). (Laruence) + - Streams: . Fixed bug #72439 (Stream socket with remote address leads to a segmentation fault). (Laruence) diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index b380cfe..64a6c47 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;

« previous php.cvs (#92732) next »