mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix coverity defects: CID 147643, 152204, 49339
CID 147643: Type: String not null terminated - make sure that the string is null terminated before strlen and fprintf. CID 152204: Type: Copy into fixed size buffer - since strlcpy isn't availabe here, use strncpy and terminate the string manually. CID 49339: Type: Buffer not null terminated - since strlcpy isn't availabe here, terminate the string manually before fprintf. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: GeLiXin <ge.lixin@zte.com.cn> Closes #5283
This commit is contained in:
committed by
Brian Behlendorf
parent
1b81ab46d0
commit
66826e2285
@@ -154,7 +154,8 @@ do_link(const char *pfile)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
strcpy(pfile_copy, pfile);
|
||||
strncpy(pfile_copy, pfile, sizeof (pfile_copy));
|
||||
pfile_copy[sizeof (pfile_copy) - 1] = '\0';
|
||||
/*
|
||||
* Figure out source file directory name, and create
|
||||
* the link file in the same directory.
|
||||
|
||||
Reference in New Issue
Block a user