From: luozhengzheng Date: Thu, 20 Oct 2016 18:09:39 +0000 (+0800) Subject: Fix coverity defects: CID 150919, 150923 X-Git-Tag: zfs-0.7.0-rc2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f72394443f710a0be11232b557b8a698693668d;p=zfs 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 Reviewed-by: Tom Caputi Signed-off-by: luozhengzheng Closes #5298 --- diff --git a/module/icp/os/modconf.c b/module/icp/os/modconf.c index e0cd7f4ad..32b46b5ff 100644 --- a/module/icp/os/modconf.c +++ b/module/icp/os/modconf.c @@ -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) diff --git a/module/icp/spi/kcf_spi.c b/module/icp/spi/kcf_spi.c index e6e463a62..8bd86b0a3 100644 --- a/module/icp/spi/kcf_spi.c +++ b/module/icp/spi/kcf_spi.c @@ -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);