Fix coverity defects: CID 150919, 150923

CID 150919: Buffer not null terminated (BUFFER_SIZE_WARNING)
CID 150923: Buffer not null terminated (BUFFER_SIZE_WARNING)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: luozhengzheng <luo.zhengzheng@zte.com.cn>
Closes #5298
This commit is contained in:
luozhengzheng 2016-10-21 02:09:39 +08:00 committed by Brian Behlendorf
parent 381823d6d2
commit 1f72394443
2 changed files with 2 additions and 2 deletions

View File

@ -146,7 +146,7 @@ mod_info(struct modlinkage *modlp, struct modinfo *modinfop)
if (*linkpp == NULL) {
msip->msi_linkinfo[0] = '\0';
} else {
(void) strncpy(msip->msi_linkinfo,
(void) strlcpy(msip->msi_linkinfo,
(*linkpp)->misc_linkinfo, MODMAXLINKINFOLEN);
retval = MODL_INFO(*linkpp, modlp, &msip->msi_p0);
if (retval != 0)

View File

@ -889,7 +889,7 @@ kcf_do_notify(kcf_provider_desc_t *prov_desc, boolean_t is_added)
ec.ec_change = is_added ? CRYPTO_MECH_ADDED :
CRYPTO_MECH_REMOVED;
for (i = 0; i < prov_desc->pd_mech_list_count; i++) {
(void) strncpy(ec.ec_mech_name,
(void) strlcpy(ec.ec_mech_name,
prov_desc->pd_mechanisms[i].cm_mech_name,
CRYPTO_MAX_MECH_NAME);
kcf_walk_ntfylist(CRYPTO_EVENT_MECHS_CHANGED, &ec);