nemith / netconf

NETCONF implementation in Go.
Other
29 stars 7 forks source link

transport: fix infinate loop on chunkReader.Close() #71

Closed nemith closed 8 months ago

nemith commented 9 months ago

If the stream is closed before reaching the end-of-frame marker (n##n) and there is more chunks left then there is a condition where the chunkLeft is never updated resulting in a loop in Close().

This probably needs a deeper rethink but at very least if we reach the end-of-frame marker we should update the r.chunkLeft before returning the error to clean up and also make sure to record the bytes discarded.

Thanks to @nights99 for reporting this

Fixes: #69