From: Fred Morcos Date: Wed, 24 Aug 2022 21:13:49 +0000 (+0200) Subject: Log "NULL" for nullptr-bound properties instead of dereferencing X-Git-Tag: rec-4.8.0-alpha1~46^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11882%2Fhead;p=thirdparty%2Fpdns.git Log "NULL" for nullptr-bound properties instead of dereferencing Fixes the issue where pdnsutil would segfault when query logging is enabled, and would leave the db unmodified. Surprisingly, the segfault only happened on FreeBSD. Fixes #11731 --- diff --git a/modules/gpgsqlbackend/spgsql.cc b/modules/gpgsqlbackend/spgsql.cc index 996d72dbc7..823d38dd3e 100644 --- a/modules/gpgsqlbackend/spgsql.cc +++ b/modules/gpgsqlbackend/spgsql.cc @@ -85,7 +85,13 @@ public: if (i != 0) { log_message << ", "; } - log_message << "$" << (i + 1) << " = '" << paramValues[i] << "'"; + log_message << "$" << (i + 1) << " = "; + if (paramValues[i] == nullptr) { + log_message << "NULL"; + } + else { + log_message << "'" << paramValues[i] << "'"; + } } g_log << Logger::Warning << log_message.str() << endl; }