diff --git a/examples/utilities/load_ini_buffer.h b/examples/utilities/load_ini_buffer.h index 1620b3a..e5aae88 100644 --- a/examples/utilities/load_ini_buffer.h +++ b/examples/utilities/load_ini_buffer.h @@ -30,7 +30,10 @@ int load_ini_buffer ( void * const user_data ) { - char * const ini_cache = malloc(ini_length); + /* `strip_ini_cache()` documents that it will immediately write a NUL + terminator at `ini_source[ini_length]`, so the buffer must be able to + hold `ini_length + 1` bytes. */ + char * const ini_cache = malloc(ini_length + 1); if (!ini_cache) {