lmu->lum_hash_type = lsa.lsa_pattern;
else
lmu->lum_hash_type = LMV_HASH_TYPE_DEFAULT;
- if (lsa.lsa_pool_name)
+ if (lsa.lsa_pool_name) {
strncpy(lmu->lum_pool_name, lsa.lsa_pool_name,
sizeof(lmu->lum_pool_name) - 1);
+ lmu->lum_pool_name[sizeof(lmu->lum_pool_name) - 1] = 0;
+ }
if (lsa.lsa_nr_tgts > 1) {
int i;
/* If the path isn't set return the first one we find */
if (path == NULL || strlen(path) == 0) {
strncpy(mntdir, mnt.mnt_dir, sizeof(mntdir) - 1);
- mntdir[strlen(mnt.mnt_dir)] = '\0';
+ mntdir[sizeof(mntdir) - 1] = '\0';
if ((want & WANT_FSNAME) && fsname != NULL) {
strncpy(fsname, ptr, ptr_end - ptr);
fsname[ptr_end - ptr] = '\0';
/* Otherwise find the longest matching path */
} else if ((strlen(path) >= mntlen) && (mntlen >= len) &&
(strncmp(mnt.mnt_dir, path, mntlen) == 0)) {
- strncpy(mntdir, mnt.mnt_dir, sizeof(mntdir));
- mntdir[strlen(mnt.mnt_dir)] = '\0';
+ strncpy(mntdir, mnt.mnt_dir, sizeof(mntdir) - 1);
+ mntdir[sizeof(mntdir) - 1] = '\0';
len = mntlen;
if ((want & WANT_FSNAME) && fsname != NULL) {
strncpy(fsname, ptr, ptr_end - ptr);