Attached is a patch that fixes this problem.  The problem seems to occur
when a \r is the last char in the data buffer.


-- 
Chris Field
[EMAIL PROTECTED]
Affinity Solutions Inc.
350 5th Avenue
22nd Floor
New York, NY 10118
(212) 822-9620

--- php-4.3.8/ext/ftp/ftp.c     2004-03-31 15:44:04.000000000 -0500
+++ php-4.3.8/ext/ftp/ftp.c.1   2004-09-30 08:35:59.000000000 -0400
@@ -727,12 +727,12 @@
                                ptr = s;
                        }
 #else 
-                       while ((s = memchr(ptr, '\r', (e - ptr)))) {
+                       while ((e>ptr) && (s = memchr(ptr, '\r', (e - ptr)))) {
                                php_stream_write(outstream, ptr, (s - ptr));
                                if (*(s + 1) == '\n') {
                                        s++;
+                                       php_stream_putc(outstream, '\n');
                                }
-                               php_stream_putc(outstream, '\n');
                                ptr = s + 1;
                        }
 #endif
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to