From be9c6d5fc69625f4ba12d76ed7ba9292642ce505 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 4 Apr 2019 10:58:00 +0900 Subject: [PATCH] Use correct sizeof() argument in a couple of strncpy calls Source and destination buffers are however the same length in both cases. Per GitHub #561. --- repmgr-action-cluster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repmgr-action-cluster.c b/repmgr-action-cluster.c index 7049eb48..971c4ea7 100644 --- a/repmgr-action-cluster.c +++ b/repmgr-action-cluster.c @@ -1065,7 +1065,7 @@ build_cluster_matrix(t_node_matrix_rec ***matrix_rec_dest, int *name_length, Ite matrix_rec_list[i]->node_id = cell->node_info->node_id; strncpy(matrix_rec_list[i]->node_name, cell->node_info->node_name, - sizeof(cell->node_info->node_name)); + sizeof(matrix_rec_list[i]->node_name)); /* * Find the maximum length of a node name @@ -1280,7 +1280,7 @@ build_cluster_crosscheck(t_node_status_cube ***dest_cube, int *name_length, Item cube[h] = (t_node_status_cube *) pg_malloc(sizeof(t_node_status_cube)); cube[h]->node_id = cell->node_info->node_id; - strncpy(cube[h]->node_name, cell->node_info->node_name, sizeof(cell->node_info->node_name)); + strncpy(cube[h]->node_name, cell->node_info->node_name, sizeof(cube[h]->node_name)); /* * Find the maximum length of a node name