mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Replace sprintf()->snprintf() and strcpy()->strlcpy()
The strcpy() and sprintf() functions are deprecated on some platforms. Care is needed to ensure correct size is used. If some platforms miss snprintf, we can add a #define to sprintf, likewise strlcpy(). The biggest change is adding a size parameter to zfs_id_to_fuidstr(). The various *_impl_get() functions are only used on linux and have not yet been updated. Reviewed by: Sean Eric Fagan <sef@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Jorgen Lundman <lundman@lundman.net> Closes #10400
This commit is contained in:
@@ -778,7 +778,7 @@ zfs_fuid_txhold(zfsvfs_t *zfsvfs, dmu_tx_t *tx)
|
||||
*/
|
||||
int
|
||||
zfs_id_to_fuidstr(zfsvfs_t *zfsvfs, const char *domain, uid_t rid,
|
||||
char *buf, boolean_t addok)
|
||||
char *buf, size_t len, boolean_t addok)
|
||||
{
|
||||
uint64_t fuid;
|
||||
int domainid = 0;
|
||||
@@ -789,7 +789,7 @@ zfs_id_to_fuidstr(zfsvfs_t *zfsvfs, const char *domain, uid_t rid,
|
||||
return (SET_ERROR(ENOENT));
|
||||
}
|
||||
fuid = FUID_ENCODE(domainid, rid);
|
||||
(void) sprintf(buf, "%llx", (longlong_t)fuid);
|
||||
(void) snprintf(buf, len, "%llx", (longlong_t)fuid);
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user