Page MenuHomePhabricator

D18857.diff
No OneTemporary

D18857.diff

diff --git a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php
--- a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php
+++ b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php
@@ -192,6 +192,13 @@
$this->state = 'data-bytes';
}
} else if ($this->state == 'data-bytes') {
+ // If we don't have any more bytes on the buffer yet, just bail:
+ // otherwise, we'll emit a pointless and possibly harmful 0-byte data
+ // frame. See T13036 for discussion.
+ if (!strlen($this->buffer)) {
+ break;
+ }
+
$bytes = substr($this->buffer, 0, $this->expectBytes);
$this->buffer = substr($this->buffer, strlen($bytes));
$this->expectBytes -= strlen($bytes);

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 12:13 PM (2 d, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6762788
Default Alt Text
D18857.diff (922 B)

Event Timeline