BufferedFile readline() does not check for newline characters if buffer size is met or exceeded #428
Paramiko version: 1.15
I'm running into an issue with the readline() function in BufferedFile. It appears that when the buffer size is met or exceeded, the function will return a buffer size chunk of the file and not attempt to locate newline characters.
Documentation of readline()
My interpretation of the documentation is that readline() should read up to the next newline character or buffer size bytes, whichever comes first. If readline() is given a file greater than or equal to the buffer size it should always look for a newline character or, failing that, return up to buffer size bytes. If my understanding is correct, then I think there is a problem in the following code.
From BufferedFile readline():
The problem lies with line 227.
This exits the function with a buffer size chunk before any search is made for newline characters. It's possible there are lines within that buffer size chunk, but we never look so they are disregarded in this case.
Thanks for taking the time to read this and for your work on Paramiko!
The text was updated successfully, but these errors were encountered: