Browse Source

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

flysand7 1 year ago
parent
commit
a7d95ab3e1
1 changed files with 1 additions and 1 deletions
  1. 1 1
      core/os/file_windows.odin

+ 1 - 1
core/os/file_windows.odin

@@ -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