php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #77680
Patch fix-77680 revision 2019-03-01 15:47 UTC by cmb@php.net

Patch fix-77680 for Directory function related Bug #77680

Patch version 2019-03-01 15:47 UTC

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

Developer: cmb@php.net

 ext/standard/ftp_fopen_wrapper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 26e55cba01..d2f2041ca1 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -1069,6 +1069,9 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, in
 
         /* find a top level directory we need to create */
         while ((p = strrchr(buf, '/'))) {
+			if (p == buf) {
+				break;
+			}
             *p = '\0';
 			php_stream_printf(stream, "CWD %s\r\n", buf);
 			result = GET_FTP_RESULT(stream);
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Apr 02 11:01:22 2020 UTC