diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-06-13 17:27:30 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-06-13 17:27:30 -0700 |
commit | 1ba6bff90226a609700b8e78345a41bbe1997845 (patch) | |
tree | 11d413a9d5ef3378db4790b470888156c7709b98 /super-ddf.c | |
parent | 56aca704a573fad2c60d2fafba110e11670b9dae (diff) | |
download | mdadm-1ba6bff90226a609700b8e78345a41bbe1997845.tar.gz mdadm-1ba6bff90226a609700b8e78345a41bbe1997845.tar.xz mdadm-1ba6bff90226a609700b8e78345a41bbe1997845.zip |
ddf: fix 'ddf' pointer corruption
hostname[17] = 0 overwrites the last byte of the ddf pointer
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'super-ddf.c')
-rw-r--r-- | super-ddf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/super-ddf.c b/super-ddf.c index 2ec04a7..0d2a456 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -1561,8 +1561,8 @@ static int init_super_ddf(struct supertype *st, * Remaining 16 are serial number.... maybe a hostname would do? */ memcpy(ddf->controller.guid, T10, sizeof(T10)); - gethostname(hostname, 17); - hostname[17] = 0; + gethostname(hostname, sizeof(hostname)); + hostname[sizeof(hostname) - 1] = 0; hostlen = strlen(hostname); memcpy(ddf->controller.guid + 24 - hostlen, hostname, hostlen); for (i = strlen(T10) ; i+hostlen < 24; i++) |