658b6c
From ac83d8ce3d8dd868b0e887528e7c269cee4dcac8 Mon Sep 17 00:00:00 2001
658b6c
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
658b6c
Date: Tue, 31 Jul 2018 15:57:38 +0200
658b6c
Subject: [PATCH] fence_kdump: fix strncpy issue
658b6c
658b6c
---
658b6c
 agents/kdump/fence_kdump.c      | 2 +-
658b6c
 agents/kdump/fence_kdump_send.c | 2 +-
658b6c
 2 files changed, 2 insertions(+), 2 deletions(-)
658b6c
658b6c
diff --git a/agents/kdump/fence_kdump.c b/agents/kdump/fence_kdump.c
658b6c
index e2f3cd80..768a9344 100644
658b6c
--- a/agents/kdump/fence_kdump.c
658b6c
+++ b/agents/kdump/fence_kdump.c
658b6c
@@ -351,7 +351,7 @@ get_options_node (fence_kdump_opts_t *opts)
658b6c
     hints.ai_protocol = IPPROTO_UDP;
658b6c
     hints.ai_flags = AI_NUMERICSERV;
658b6c
 
658b6c
-    strncpy (node->name, opts->nodename, sizeof (node->name));
658b6c
+    strncpy (node->name, opts->nodename, sizeof (node->name) - 1);
658b6c
     snprintf (node->port, sizeof (node->port), "%d", opts->ipport);
658b6c
 
658b6c
     node->info = NULL;
658b6c
diff --git a/agents/kdump/fence_kdump_send.c b/agents/kdump/fence_kdump_send.c
658b6c
index d668bed3..638f8c97 100644
658b6c
--- a/agents/kdump/fence_kdump_send.c
658b6c
+++ b/agents/kdump/fence_kdump_send.c
658b6c
@@ -116,7 +116,7 @@ get_options_node (fence_kdump_opts_t *opts)
658b6c
     hints.ai_protocol = IPPROTO_UDP;
658b6c
     hints.ai_flags = AI_NUMERICSERV;
658b6c
 
658b6c
-    strncpy (node->name, opts->nodename, sizeof (node->name));
658b6c
+    strncpy (node->name, opts->nodename, sizeof (node->name) - 1);
658b6c
     snprintf (node->port, sizeof (node->port), "%d", opts->ipport);
658b6c
 
658b6c
     node->info = NULL;