File libffs-fix-string-truncation.patch of Package skiboot

From 235a280711265ed67d35b3781f6c7d6e7e83bda9 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 25 Jan 2019 12:54:12 +0100
Subject: [PATCH] libffs: Fix string truncation gcc warning.

Allow one more byte copied. The allocated space has extra byte anyway.
---
 libflash/libffs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libflash/libffs.c b/libflash/libffs.c
index 221c2b02..4eb0ffa9 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -522,7 +522,7 @@ int ffs_part_info(struct ffs_handle *ffs, uint32_t part_idx,
 		n = calloc(1, FFS_PART_NAME_MAX + 1);
 		if (!n)
 			return FLASH_ERR_MALLOC_FAILED;
-		strncpy(n, ent->name, FFS_PART_NAME_MAX);
+		strncpy(n, ent->name, FFS_PART_NAME_MAX + 1);
 		*name = n;
 	}
 	return 0;
-- 
2.19.1

openSUSE Build Service is sponsored by