]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
IMSM: use strcpy rather than pointless strncpy.
authorNeilBrown <neilb@suse.de>
Thu, 3 Jul 2014 05:04:01 +0000 (15:04 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 3 Jul 2014 05:04:01 +0000 (15:04 +1000)
As strncpy doesn't guarantee to nul-terminate, some static
analysers get upset that it is followed by a 'strncat'.
So just use a 'strcpy' - strlen(disk_by_path) is constant
and definitely less than PATH_MAX.

Link: https://github.com/neilbrown/mdadm/issues/4
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index 9dd807ac3201bcff23b7ed50db5f543607408e64..0106b4f699ff661f04274c8349601fa44bd18212 100644 (file)
@@ -9357,7 +9357,7 @@ static const char *imsm_get_disk_controller_domain(const char *path)
        char *drv=NULL;
        struct stat st;
 
-       strncpy(disk_path, disk_by_path, PATH_MAX - 1);
+       strcpy(disk_path, disk_by_path);
        strncat(disk_path, path, PATH_MAX - strlen(disk_path) - 1);
        if (stat(disk_path, &st) == 0) {
                struct sys_dev* hba;