Home » HTTP » HTTP_WebDAV_Client » Bug #7714
End of file marker not set in stream_read
Details
| Submitted | 2006-05-24 11:36 UTC |
|---|---|
| From | clef at gmx dot de |
| Assigned | hholzgra |
| Status | Closed |
| Package | HTTP_WebDAV_Client |
| PHP Version | 4.4.2 |
| OS | Win XP |
| Roadmaps | (Not assigned) |
Comments
[2006-05-24 11:36 UTC] clef at gmx dot de
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;
}