Closed
Description
Looking at the code without prior knowledge of Windows system call semantics, I see an infinite loop if the syscall were to fill up the buffer exactly: when k == n on line 195, the loop will be rerun with no changes, which should result in the exact same outcome if the syscall is idempotent.
Even if Windows guarantees in some way that this cannot happen, would it not be clearer to handle this case in an obvious fashion?