summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch')
-rw-r--r--net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch b/net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch
new file mode 100644
index 000000000000..b76ce8761326
--- /dev/null
+++ b/net-analyzer/pmacct/files/pmacct-1.7.6-fix-mysql-crash.patch
@@ -0,0 +1,26 @@
+From 1922062277d87da024938cc3057df9a4c3725e76 Mon Sep 17 00:00:00 2001
+From: Paolo Lucente <pl+github@pmacct.net>
+Date: Sun, 28 Feb 2021 02:51:10 +0000
+Subject: [PATCH] * fix, MySQL plugin: check for 'unix:' string only if
+ sql_host is supplied
+
+---
+ src/mysql_plugin.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/mysql_plugin.c b/src/mysql_plugin.c
+index 7f5179abd..dce117732 100644
+--- a/src/mysql_plugin.c
++++ b/src/mysql_plugin.c
+@@ -695,7 +695,10 @@ void MY_DB_Connect(struct DBdesc *db, char *host)
+ mysql_options(db->desc, MYSQL_OPT_RECONNECT, &reconnect);
+ if (config.sql_conn_ca_file) mysql_ssl_set(db->desc, NULL, NULL, config.sql_conn_ca_file, NULL, NULL);
+
+- usp = strstr(host, "unix:");
++ if (host) {
++ usp = strstr(host, "unix:");
++ }
++
+ if (usp && usp == host) {
+ usp += 5; /* go right past the 'unix:' string */
+ mysql_ret = mysql_real_connect(db->desc, NULL, config.sql_user, config.sql_passwd, config.sql_db, FALSE, usp, 0);