From 38e4e551b9f576cdba596a0f00f1b64d2bad77c3 Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 30 Sep 2024 08:53:31 +1000 Subject: [PATCH] If we are given a zero byte file, we SKIP it --- app/Classes/Protocol/Binkp.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Classes/Protocol/Binkp.php b/app/Classes/Protocol/Binkp.php index f3cd325..d8aaf04 100644 --- a/app/Classes/Protocol/Binkp.php +++ b/app/Classes/Protocol/Binkp.php @@ -663,7 +663,7 @@ final class Binkp extends BaseProtocol $offs = (int)$this->strsep($str,' '); $flags = $this->strsep($str,' '); - if ($name && $size && $time) { + if ($name && is_numeric($size) && $time) { return [ 'file'=>['name'=>$name,'size'=>$size,'mtime'=>$time], 'offs'=>$offs, @@ -918,6 +918,14 @@ final class Binkp extends BaseProtocol $this->recv->new($file['file'],$this->node->address,$this->force_queue); + // If the file is zero byte size, we'll skip it + if ($this->recv->recvsize === 0) { + Log::error(sprintf('%s:! SKIPPING zero byte file info [%s]',self::LOGKEY,$this->recv->nameas)); + + $this->msgs(self::BPM_SKIP,$this->recv->name_size_time); + return TRUE; + } + try { switch ($this->recv->open($file['offs']<0,$file['flags'])) { case self::FOP_ERROR: