diff options
Diffstat (limited to 'module/icp/os')
-rw-r--r-- | module/icp/os/modhash.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/module/icp/os/modhash.c b/module/icp/os/modhash.c index 5e216ed6a..a89787100 100644 --- a/module/icp/os/modhash.c +++ b/module/icp/os/modhash.c @@ -453,17 +453,19 @@ mod_hash_create_extended( int sleep) /* whether to sleep for mem */ { mod_hash_t *mod_hash; + size_t size; ASSERT(hname && keycmp && hash_alg && vdtor && kdtor); if ((mod_hash = kmem_zalloc(MH_SIZE(nchains), sleep)) == NULL) return (NULL); - mod_hash->mh_name = kmem_alloc(strlen(hname) + 1, sleep); + size = strlen(hname) + 1; + mod_hash->mh_name = kmem_alloc(size, sleep); if (mod_hash->mh_name == NULL) { kmem_free(mod_hash, MH_SIZE(nchains)); return (NULL); } - (void) strcpy(mod_hash->mh_name, hname); + (void) strlcpy(mod_hash->mh_name, hname, size); rw_init(&mod_hash->mh_contents, NULL, RW_DEFAULT, NULL); mod_hash->mh_sleep = sleep; |