diff options
| author | Zac Pierson <zacpiersonhehe@gmail.com> | 2017-03-21 16:00:11 -0500 |
|---|---|---|
| committer | Zac Pierson <zacpiersonhehe@gmail.com> | 2017-03-21 16:00:11 -0500 |
| commit | e935f8e2ffc19294573025287a08dcbe9137e282 (patch) | |
| tree | db9499bb36da04543bdf2866afd9717611362061 /core/os_linux.odin | |
| parent | 690c6828476b0714464adf4813fde37a841104d7 (diff) | |
Fixed os_linux and os_x read_entire_file function not null-terminating data.
Diffstat (limited to 'core/os_linux.odin')
| -rw-r--r-- | core/os_linux.odin | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/os_linux.odin b/core/os_linux.odin index 0fd8287ce..52b9dad51 100644 --- a/core/os_linux.odin +++ b/core/os_linux.odin @@ -146,13 +146,14 @@ read_entire_file :: proc(name: string) -> ([]byte, bool) { // We have a file size! - data := new_slice(u8, size); + data := new_slice(u8, size+1); if data.data == nil { fmt.println("Failed to allocate file buffer."); return nil, false; } read(handle, data); + data[size] = 0; return data, true; } |