From 962598259e593756ffdabdee51348c0247d96d47 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 3 May 2017 08:20:51 +0900 Subject: [PATCH] Don't try and copy a NULL pointer --- repmgr-action-master.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/repmgr-action-master.c b/repmgr-action-master.c index 2f5e8d91..086df23a 100644 --- a/repmgr-action-master.c +++ b/repmgr-action-master.c @@ -131,7 +131,10 @@ do_master_register(void) /* update node record structure with settings from config file */ strncpy(node_info.node_name, config_file_options.node_name, MAXLEN); strncpy(node_info.conninfo, config_file_options.conninfo, MAXLEN); - strncpy(node_info.slot_name, repmgr_slot_name_ptr, MAXLEN); + + if (repmgr_slot_name_ptr != NULL) + strncpy(node_info.slot_name, repmgr_slot_name_ptr, MAXLEN); + node_info.priority = config_file_options.priority; initPQExpBuffer(&event_description); @@ -168,7 +171,6 @@ do_master_register(void) } - /* Log the event */ create_event_record(conn, &config_file_options,