IMSM: use strcpy rather than pointless strncpy.

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>
This commit is contained in:
NeilBrown 2014-07-03 15:04:01 +10:00
parent e339dba2a1
commit 6d8d290a2f
1 changed files with 1 additions and 1 deletions

View 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;