File kexec-fix-strncat.patch of Package kexec-tools

Index: kexec-tools-2.0.2/kexec/arch/ppc64/fs2dt.c
===================================================================
--- kexec-tools-2.0.2.orig/kexec/arch/ppc64/fs2dt.c
+++ kexec-tools-2.0.2/kexec/arch/ppc64/fs2dt.c
@@ -594,7 +594,7 @@ static void putnode(void)
 		 * pseries/hvcterminal is supported.
 		 */
 		strcpy(filename, pathname);
-		strncat(filename, "linux,stdout-path", MAXPATH);
+		strncat(filename, "linux,stdout-path", MAXPATH-strlen(filename)-1);
 		fd = open(filename, O_RDONLY);
 		if (fd == -1) {
 			printf("Unable to find %s, printing from purgatory is diabled\n",
@@ -618,8 +618,8 @@ static void putnode(void)
 		read(fd, buff, statbuf.st_size);
 		close(fd);
 		strncpy(filename, "/proc/device-tree/", MAXPATH);
-		strncat(filename, buff, MAXPATH);
-		strncat(filename, "/compatible", MAXPATH);
+		strncat(filename, buff, MAXPATH-strlen(filename)-1);
+		strncat(filename, "/compatible", MAXPATH-strlen(filename)-1);
 		fd = open(filename, O_RDONLY);
 		if (fd == -1) {
 			printf("Unable to find %s printing from purgatory is diabled\n",