asyncftpclient.nim - don't assume a sufficiend line length (#14973)

This commit is contained in:
Miran 2020-07-14 08:18:02 +02:00 • committed by GitHub
commit f4f21c89e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,7 +134,7 @@ proc expectReply(ftp: AsyncFtpClient): Future[TaintedString] {.async.} =
var line = await ftp.csock.recvLine()
result = TaintedString(line)
var count = 0
while line[3] == '-':
while line.len > 3 and line[3] == '-':
## Multi-line reply.
line = await ftp.csock.recvLine()
string(result).add("\n" & line)