diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c index ac2c09a0d5..583b4d104d 100644 --- a/gfx/drivers_context/wgl_ctx.c +++ b/gfx/drivers_context/wgl_ctx.c @@ -357,12 +357,14 @@ static void create_gl_context(HWND hwnd, bool *quit) wglGetExtensionsStringARB = (const char *(WINAPI *) (HDC)) gfx_ctx_wgl_get_proc_address("wglGetExtensionsStringARB"); if (wglGetExtensionsStringARB) - extensions = wglGetExtensionsStringARB(win32_hdc); - RARCH_LOG("[WGL] extensions: %s\n", extensions); - if (wgl_has_extension("WGL_EXT_swap_control_tear", extensions)) { - RARCH_LOG("[WGL]: Adaptive VSync supported.\n"); - wgl_adaptive_vsync = true; + extensions = wglGetExtensionsStringARB(win32_hdc); + RARCH_LOG("[WGL] extensions: %s\n", extensions); + if (wgl_has_extension("WGL_EXT_swap_control_tear", extensions)) + { + RARCH_LOG("[WGL]: Adaptive VSync supported.\n"); + wgl_adaptive_vsync = true; + } } } } diff --git a/verbosity.c b/verbosity.c index 31ba3db947..9d362acd66 100644 --- a/verbosity.c +++ b/verbosity.c @@ -218,9 +218,27 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) #else FILE *fp = (FILE*)log_file_fp; #if defined(HAVE_QT) || defined(__WINRT__) + int ret; char buffer[256]; buffer[0] = '\0'; - vsnprintf(buffer, sizeof(buffer), fmt, ap); + ret = vsnprintf(buffer, sizeof(buffer), fmt, ap); + + /* ensure null termination and line break in error case */ + if (ret < 0) + { + int end; + buffer[sizeof buffer - 1] = '\0'; + end = strlen(buffer) - 1; + if (end >= 0) + { + buffer[end] = '\n'; + } + else + { + buffer[0] = '\n'; + buffer[1] = '\0'; + } + } if (fp) {