From 8f6b84d86c7313f6c897e334876d9ab31686261c Mon Sep 17 00:00:00 2001 From: The Tumultuous Unicorn Of Darkness Date: Sun, 4 Aug 2024 14:59:52 +0200 Subject: [PATCH] Fix SEGFAULT in debugf() when using --quiet The `--quiet` option calls `cpuid_set_warn_function(NULL)`, but debugf() was not checking if _warn_fun is defined unlike warnf() --- libcpuid/libcpuid_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpuid/libcpuid_util.c b/libcpuid/libcpuid_util.c index c0dd0a5..5d2d366 100644 --- a/libcpuid/libcpuid_util.c +++ b/libcpuid/libcpuid_util.c @@ -73,7 +73,7 @@ void debugf(int verboselevel, const char* format, ...) { char buff[1024]; va_list va; - if (verboselevel > _current_verboselevel) return; + if (!_warn_fun || (verboselevel > _current_verboselevel)) return; va_start(va, format); vsnprintf(buff, sizeof(buff), format, va); va_end(va);