Commit ac3fca56 authored by Ingvar Stepanyan's avatar Ingvar Stepanyan

Detect EOF in copyChunk

If holes are not supported on the target system and size to `copy` was passed as `kj::maxValue()`, this could lead to near-infinite loops.
parent c55728b8
...@@ -502,6 +502,7 @@ public: ...@@ -502,6 +502,7 @@ public:
default: default:
KJ_FAIL_SYSCALL("sendfile", error) { return fromPos - fromOffset; } KJ_FAIL_SYSCALL("sendfile", error) { return fromPos - fromOffset; }
} }
if (n == 0) break;
} }
return fromPos - fromOffset; return fromPos - fromOffset;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment