mdadm/0009-mdadm-Specify-enough-length-when-write-to-buffer.patch
Neil Brown 850cf2857b Accepting request 517978 from home:colyli:branches:Base:System
- SLE15 continues to use mdadm-4.0, synchronize mdadm package from
  SLE12-SP3 to SLE15, re-order all patches.
- Rename the following patches, they are deleted and re-add in next
  part of patches
    0001-Generic-support-for-consistency-policy-and-PPL.patch
    0002-Detail-show-consistency-policy.patch
    0002-The-mdcheck-script-now-adds-messages-to-the-system.patch
    0003-imsm-PPL-support.patch
    0004-super1-PPL-support.patch
    0005-Add-ppl-and-no-ppl-options-for-update.patch
    0006-Grow-support-consistency-policy-change.patch
    0007-udev-md-raid-assembly.rules-Skip-non-ready-devices.patch
    0008-Retry-HOT_REMOVE_DISK-a-few-times.patch
    0009-Introduce-sys_hot_remove_disk.patch
    0010-Add-force-flag-to-hot_remove_disk.patch
    0011-Detail-handle-non-existent-arrays-better.patch
- Synchronize patches from mdadm of SLE12-SP3, the above renamed
  patches are re-add here,
    0001-Makefile-Fix-date-to-be-output-in-ISO-format.patch
    0002-imsm-fix-missing-error-message-during-migration.patch
    0003-Fix-oddity-where-mdadm-did-not-recognise-a-relative-.patch
    0004-mdadm-check-the-nodes-when-operate-clustered-array.patch
    0005-examine-tidy-up-some-code.patch
    0006-mdadm-add-man-page-for-symlinks.patch
    0007-mdadm-add-checking-clustered-bitmap-in-assemble-mode.patch
    0008-mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch
    0009-mdadm-Specify-enough-length-when-write-to-buffer.patch
    0010-mdadm-it-doesn-t-make-sense-to-set-bitmap-twice.patch
    0011-mdadm-Monitor-Fix-NULL-pointer-dereference-when-stat.patch
    0012-Replace-snprintf-with-strncpy-at-some-places-to-avoi.patch

OBS-URL: https://build.opensuse.org/request/show/517978
OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=150
2017-08-22 22:29:34 +00:00

75 lines
2.2 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From ff9239ee3177630d62c7a58408992af7a779763c Mon Sep 17 00:00:00 2001
From: Xiao Ni <xni@redhat.com>
Date: Fri, 17 Mar 2017 19:55:43 +0800
Subject: [PATCH] mdadm: Specify enough length when write to buffer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In Detail.c the buffer path in function Detail is defined as path[200],
in fact the max lenth of content which needs to write to the buffer is
287. Because the length of dname of struct dirent is 255.
During building it reports error:
error: %s directive writing up to 255 bytes into a region of size 189
[-Werror=format-overflow=]
In function examine_super0 there is a buffer nb with length 5.
But it need to show a int type argument. The lenght of max
number of int is 10. So the buffer length should be 11.
In human_size function the length of buf is 30. During building
there is a error:
output between 20 and 47 bytes into a destination of size 30.
Change the length to 47.
Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
---
Detail.c | 2 +-
super0.c | 2 +-
util.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Detail.c b/Detail.c
index 509b0d4..cb33794 100644
--- a/Detail.c
+++ b/Detail.c
@@ -575,7 +575,7 @@ This is pretty boring
printf(" Member Arrays :");
while (dir && (de = readdir(dir)) != NULL) {
- char path[200];
+ char path[287];
char vbuf[1024];
int nlen = strlen(sra->sys_name);
dev_t devid;
diff --git a/super0.c b/super0.c
index 938cfd9..f5b4507 100644
--- a/super0.c
+++ b/super0.c
@@ -231,7 +231,7 @@ static void examine_super0(struct supertype *st, char *homehost)
d++) {
mdp_disk_t *dp;
char *dv;
- char nb[5];
+ char nb[11];
int wonly, failfast;
if (d>=0) dp = &sb->disks[d];
else dp = &sb->this_disk;
diff --git a/util.c b/util.c
index f100972..32bd909 100644
--- a/util.c
+++ b/util.c
@@ -811,7 +811,7 @@ unsigned long calc_csum(void *super, int bytes)
#ifndef MDASSEMBLE
char *human_size(long long bytes)
{
- static char buf[30];
+ static char buf[47];
/* We convert bytes to either centi-M{ega,ibi}bytes or
* centi-G{igi,ibi}bytes, with appropriate rounding,
--
2.10.2