From 397e0ed5bee0617910ec03b014dad0b1aa3976f5 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 20 Oct 2020 09:51:49 +0900 Subject: [PATCH] Silence potential compiler complaint *We* know the target buffer is sufficiently sized to accept the source string, but the compiler doesn't. --- dbutils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dbutils.c b/dbutils.c index 9ad77a2e..1d55a0c9 100644 --- a/dbutils.c +++ b/dbutils.c @@ -5854,8 +5854,9 @@ is_downstream_node_attached(PGconn *conn, char *node_name, char **node_state) if (node_state != NULL) { - *node_state = palloc0(strlen(state) + 1); - strncpy(*node_state, state, strlen(state)); + int state_len = strlen(state); + *node_state = palloc0(state_len + 1); + strncpy(*node_state, state, state_len); } if (strcmp(state, "streaming") != 0)