From d275cbdd079f5226dc51dc677e44885785ab90f7 Mon Sep 17 00:00:00 2001 From: MysterD Date: Wed, 13 Apr 2022 21:24:38 -0700 Subject: [PATCH] Fix buffer overrun --- data/dynos_bin_read.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/dynos_bin_read.cpp b/data/dynos_bin_read.cpp index 5dba78b6..e19aef5d 100644 --- a/data/dynos_bin_read.cpp +++ b/data/dynos_bin_read.cpp @@ -104,6 +104,9 @@ char *DynOS_Read_Buffer(FILE* aFile, GfxData* aGfxData) { } } + // Make sure it's NULL terminated + _FileBuffer[_Length] = '\0'; + return _FileBuffer; } @@ -142,6 +145,9 @@ void DynOS_Read_Source(GfxData *aGfxData, const SysPath &aFilename) { while (*c != '\n' && *c != '\0') { c++; } + if (*c == '\0') { + break; + } } // Reading data type name