php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch add-undeflow-check for *Directory/Filesystem functions Bug #77484

Patch version 2019-01-18 16:56 UTC

Return to Bug #77484 | Download this patch
Patch Revisions:

Developer: cmb@php.net

 Zend/zend_virtual_cwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index 8d63508d2a..54fa01585b 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -498,7 +498,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
 	ALLOCA_FLAG(use_heap)
 
 	while (1) {
-		if (len <= start) {
+		if (len <= start || len == (size_t)-1) {
 			if (link_is_dir) {
 				*link_is_dir = 1;
 			}
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jun 16 00:01:24 2021 UTC