Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #7714 End of file marker not set in stream_read
Submitted: 2006-05-24 11:36 UTC
From: clef at gmx dot de Assigned: hholzgra
Status: Closed Package: HTTP_WebDAV_Client (version 0.9.7)
PHP Version: 4.4.2 OS: Win XP
Roadmaps: (Not assigned)    

 [2006-05-24 11:36 UTC] clef at gmx dot de (Hendrik)
Description: ------------ When reading a file in a while loop, as shown in the script, it is asumed that the end of file marker is retrieved. Yet, this is not the case leading to a buffer overflow. Due to line 265 in the Stream.php. The HTTP Request returns 416 when reading beyond the end of the file. The return value ($data) is cleaned, though the $len value isn't set to 0. This is crucial for line 275 where the end of file marker is set. It is not set by cleaning $data which contains the server message, because the $len value is retrieved before the switch operation. Possible solutions: - set the $len value to 0 when setting $data to "" - retrieve the length of $data after the switch Test script: --------------- if ($fp = fopen("webdav://wampp:xampp@localhost/webdav/webdav.txt", "r")) { while (!feof($fp)) { $buffer .= fread($fp, 1024); } echo $buffer; }


 [2006-07-08 16:07 UTC] hholzgra (Hartmut Holzgraefe)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.