libs/vkd3d-common: Terminate string with '\0' unconditionally in vkd3d_debug_sprintf().

This commit is contained in:
Józef Kucia 2017-06-21 12:22:19 +02:00
parent feb5e8259c
commit f7e738c27a

View File

@ -92,14 +92,12 @@ const char *vkd3d_dbg_sprintf(const char *fmt, ...)
{
char *buffer;
va_list args;
int size;
buffer = get_buffer();
va_start(args, fmt);
size = vsnprintf(buffer, VKD3D_DEBUG_BUFFER_SIZE, fmt, args);
vsnprintf(buffer, VKD3D_DEBUG_BUFFER_SIZE, fmt, args);
va_end(args);
if (size == -1 || size >= VKD3D_DEBUG_BUFFER_SIZE)
buffer[VKD3D_DEBUG_BUFFER_SIZE - 1] = '\0';
buffer[VKD3D_DEBUG_BUFFER_SIZE - 1] = '\0';
return buffer;
}