Fixed bug #72531 (ps_files_cleanup_dir Buffer overflow)

This commit is contained in:
Xinchen Hui 2016-07-03 09:30:33 +08:00
parent c9fa39da5e
commit 6744737577
2 changed files with 8 additions and 0 deletions

3
NEWS
View file

@ -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)

View file

@ -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;