diff --git a/src/utils/list_cpu_features.c b/src/utils/list_cpu_features.c index a173f866..7e970e3f 100644 --- a/src/utils/list_cpu_features.c +++ b/src/utils/list_cpu_features.c @@ -148,11 +148,13 @@ static Node* CreatePrintfString(const char* format, ...) { const int written = vsnprintf(ptr, gBumpAllocator.size, format, arglist); va_end(arglist); if (written < 0 || written >= (int)gBumpAllocator.size) internal_error(); - return CreateConstantString((char*)BA_Bump(written)); + const int null_terminated_written = written + 1; + return CreateConstantString((char*)BA_Bump(null_terminated_written)); } -// Adds a string node. +// Adds a non empty string node. static Node* CreateString(const char* value) { + if (value == NULL || *value == '\0') internal_error(); return CreatePrintfString("%s", value); }