]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Log "NULL" for nullptr-bound properties instead of dereferencing 12035/head
authorFred Morcos <fred.morcos@open-xchange.com>
Wed, 24 Aug 2022 21:13:49 +0000 (23:13 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 27 Sep 2022 11:28:59 +0000 (13:28 +0200)
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

(cherry picked from commit fd4fd2dae2f29f668b7ad0645c112b12854ab834)

modules/gpgsqlbackend/spgsql.cc

index 996d72dbc7aa4581eafecd5c4cacfdecc2c4c70a..823d38dd3eb3aa070e06632ac1c4f34f336d8300 100644 (file)
@@ -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;
       }