summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-11-19 20:05:29 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-11-19 20:05:29 +0000
commitef684b03c2713959fc3eaa04e38b5ba08cafd35c (patch)
tree260afc8bad55689873b47c6918b14685dadd885f
parent0be17796f18aa008b93d461a2f932f40e9606a24 (diff)
downloadampache-ef684b03c2713959fc3eaa04e38b5ba08cafd35c.tar.gz
ampache-ef684b03c2713959fc3eaa04e38b5ba08cafd35c.tar.bz2
ampache-ef684b03c2713959fc3eaa04e38b5ba08cafd35c.zip
prevent fread($fp,0) if a program seeks to the very end of a file
-rw-r--r--lib/class/catalog.class.php2
-rw-r--r--play/index.php4
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index 89a3a3fe..d155bbf6 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -133,7 +133,7 @@ class Catalog {
$old_path = $component_path;
$component_path = realpath($component_path . '../');
- } while ($old_path == $component_path);
+ } while ($old_path =! $component_path);
return false;
diff --git a/play/index.php b/play/index.php
index a4a73b45..f8d0dd6a 100644
--- a/play/index.php
+++ b/play/index.php
@@ -352,7 +352,9 @@ $min_bytes_streamed = $song->size / 2;
// Actually do the streaming
do {
- $buf = fread($fp, min(2048,$stream_size-$bytes_streamed));
+ $read_size = min(2048,$stream_size-$bytes_streamed);
+ if ($read_size < 1) { break; }
+ $buf = fread($fp, $read_size);
print($buf);
$bytes_streamed += strlen($buf);
} while (!feof($fp) && (connection_status() == 0) AND $bytes_streamed < $stream_size);