From 41c5a82aae7724a28b14adff166b09cff67a465d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Thu, 22 Apr 2021 17:14:52 +0200 Subject: [PATCH] Closes #3406: Verify fetched rows in 'monitor_group_replication_thread' are not NULL before accessing them --- lib/MySQL_Monitor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index 480148c44..f4645c3af 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -1501,13 +1501,15 @@ __exit_monitor_group_replication_thread: goto __end_process_group_replication_result2; } MYSQL_ROW row=mysql_fetch_row(mmsd->result); - if (!strcasecmp(row[0],"YES")) { + if (row[0] && !strcasecmp(row[0],"YES")) { viable_candidate=true; } - if (!strcasecmp(row[1],"NO")) { + if (row[1] && !strcasecmp(row[1],"NO")) { read_only=false; } - transactions_behind=atol(row[2]); + if (row[2]) { + transactions_behind=atol(row[2]); + } mysql_free_result(mmsd->result); mmsd->result=NULL; }