[core/os]: Fix read_console not stopping the read when newline can't fit in output slice

This commit is contained in:
flysand7
2024-07-12 20:23:19 +11:00
parent 1770e3a9a9
commit a7d95ab3e1

View File

@@ -125,7 +125,7 @@ read_console :: proc(handle: win32.HANDLE, b: []byte) -> (n: int, err: Errno) {
src := buf8[:buf8_len]
ctrl_z := false
for i := 0; i < len(src) && n+i < len(b); i += 1 {
for i := 0; i < len(src) && n < len(b); i += 1 {
x := src[i]
if x == 0x1a { // ctrl-z
ctrl_z = true