summaryrefslogtreecommitdiff
path: root/debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch')
-rw-r--r--debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch b/debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch
new file mode 100644
index 00000000..d3b621a3
--- /dev/null
+++ b/debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch
@@ -0,0 +1,37 @@
+From ebad3af29b401dec7203e8fa5a77bcf16532f49c Mon Sep 17 00:00:00 2001
+From: Jes Sorensen <jsorensen@fb.com>
+Date: Wed, 30 May 2018 12:10:13 -0400
+Subject: [PATCH 15/26] super-intel: Do not truncate last character of volume
+ name
+
+Clear up strncpy abuse to avoid gcc-8.1 complaining about truncating
+the string.
+
+Signed-off-by: Jes Sorensen <jsorensen@fb.com>
+---
+ super-intel.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/super-intel.c b/super-intel.c
+index 520d2921..aa93a9e9 100644
+--- a/super-intel.c
++++ b/super-intel.c
+@@ -7587,11 +7587,12 @@ static int update_subarray_imsm(struct supertype *st, char *subarray,
+ append_metadata_update(st, u, sizeof(*u));
+ } else {
+ struct imsm_dev *dev;
+- int i;
++ int i, namelen;
+
+ dev = get_imsm_dev(super, vol);
+- strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN);
+- dev->volume[MAX_RAID_SERIAL_LEN-1] = '\0';
++ memset(dev->volume, '\0', MAX_RAID_SERIAL_LEN);
++ namelen = min((int)strlen(name), MAX_RAID_SERIAL_LEN);
++ memcpy(dev->volume, name, namelen);
+ for (i = 0; i < mpb->num_raid_devs; i++) {
+ dev = get_imsm_dev(super, i);
+ handle_missing(super, dev);
+--
+2.17.1
+