diff --git a/src/system/boot/platform/efi/debug.cpp b/src/system/boot/platform/efi/debug.cpp index 9355c6a796..48724ad3ce 100644 --- a/src/system/boot/platform/efi/debug.cpp +++ b/src/system/boot/platform/efi/debug.cpp @@ -21,6 +21,8 @@ static uint32 sBufferPosition; static void syslog_write(const char* buffer, size_t length) { + if (sBufferPosition + length > sizeof(sBuffer)) + return; memcpy(sBuffer + sBufferPosition, buffer, length); sBufferPosition += length; } diff --git a/src/system/boot/platform/openfirmware/debug.cpp b/src/system/boot/platform/openfirmware/debug.cpp index 78eb3cf132..0758f30dfe 100644 --- a/src/system/boot/platform/openfirmware/debug.cpp +++ b/src/system/boot/platform/openfirmware/debug.cpp @@ -17,9 +17,11 @@ static char sBuffer[16384]; static uint32 sBufferPosition; -static void +static inline void syslog_write(const char* buffer, size_t length) { + if (sBufferPosition + length > sizeof(sBuffer)) + return; memcpy(sBuffer + sBufferPosition, buffer, length); sBufferPosition += length; } @@ -41,7 +43,7 @@ panic(const char* format, ...) } -static void +static inline void dprintf_args(const char *format, va_list args) { char buffer[512];