diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2011-11-01 04:56:12 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-11-01 04:56:12 +0100 |
commit | 2b710bac540f07489246a1d53b665f74a9c7dd50 (patch) | |
tree | 6cfb720c72d7aefc35be9982eecbe0a06f6e404f /policy.c | |
parent | policy_add(): Add missing va_end() (diff) | |
download | mdadm-2b710bac540f07489246a1d53b665f74a9c7dd50.tar.xz mdadm-2b710bac540f07489246a1d53b665f74a9c7dd50.zip |
Write_rules(): Avoid stack corruption if using extremely long udev pathname
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'policy.c')
-rw-r--r-- | policy.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -883,7 +883,8 @@ int Write_rules(char *rule_name) char udev_rule_file[PATH_MAX]; if (rule_name) { - strcpy(udev_rule_file, rule_name); + strncpy(udev_rule_file, rule_name, sizeof(udev_rule_file) - 6); + udev_rule_file[sizeof(udev_rule_file) - 6] = '\0'; strcat(udev_rule_file, ".temp"); fd = creat(udev_rule_file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); |