summaryrefslogtreecommitdiffstats
path: root/mdopen.c
diff options
context:
space:
mode:
authorRobert LeBlanc <robert@leblancnet.us>2016-08-24 18:10:44 +0200
committerJes Sorensen <Jes.Sorensen@redhat.com>2016-08-25 19:43:31 +0200
commitbd1fd72e13652416da4c646ea47549fcfdf49b26 (patch)
treeeb048de990a99b3332e717b785fe41cba48d6231 /mdopen.c
parentbitmap: Mark a number of local functions static (diff)
downloadmdadm-bd1fd72e13652416da4c646ea47549fcfdf49b26.tar.xz
mdadm-bd1fd72e13652416da4c646ea47549fcfdf49b26.zip
mdopen: Prevent overrunning the devname buffer when copying devnm into it for long md names.
Linux allows for 32 character device names. When using the maximum size device name and also storing "/dev/", devname needs to be 37 character long to store the complete device name. i.e. "/dev/md_abcdefghijklmnopqrstuvwxyz12\0" Signed-off-by: Robert LeBlanc<robert@leblancnet.us> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Diffstat (limited to 'mdopen.c')
-rw-r--r--mdopen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mdopen.c b/mdopen.c
index f818fdf3..5af344b9 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -144,7 +144,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
struct createinfo *ci = conf_get_create_info();
int parts;
char *cname;
- char devname[20];
+ char devname[37];
char devnm[32];
char cbuf[400];
if (chosen == NULL)