summaryrefslogtreecommitdiff
path: root/src/ZipStream.php
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2018-09-02 18:57:45 -0400
committerPaul Duncan <pabs@pablotron.org>2018-09-03 09:54:45 -0400
commitb86d48168233bc9e7ef9d0f92298c7f2a5554c85 (patch)
tree3b5de04ceeac1ba570849ceb1a4666c4012935b8 /src/ZipStream.php
parent1bff18eba5999ee7d7fefae0a8519411db25119a (diff)
downloadzipstream-php-b86d48168233bc9e7ef9d0f92298c7f2a5554c85.tar.bz2
zipstream-php-b86d48168233bc9e7ef9d0f92298c7f2a5554c85.zip
clean up length checks
Diffstat (limited to 'src/ZipStream.php')
-rw-r--r--src/ZipStream.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ZipStream.php b/src/ZipStream.php
index 9412438..4b2e8d5 100644
--- a/src/ZipStream.php
+++ b/src/ZipStream.php
@@ -774,6 +774,12 @@ final class Entry {
$this->time = $time;
$this->comment = $comment;
+ # check comment length
+ if (strlen($comment) >= 0xFFFF) {
+ $this->state = self::ENTRY_STATE_ERROR;
+ throw new Error('comment too long');
+ }
+
$this->uncompressed_size = 0;
$this->compressed_size = 0;
$this->len = 0;
@@ -1078,7 +1084,7 @@ final class Entry {
}
# check for long path
- if (strlen($path) > 65535) {
+ if (strlen($path) >= 0xFFFF) {
throw new PathError($path, "path too long");
}
@@ -1539,7 +1545,7 @@ final class ZipStream {
# get comment, check length
$comment = $this->args['comment'];
- if (strlen($comment) >= 65535) {
+ if (strlen($comment) >= 0xFFFF) {
throw new Error('comment too long');
}