fstyp hammer: use strlcpy

Use strlcpy to guarantee NUL termination.  Due to this, there is
no need for strncmp; simply use strcmp.

Reported by:	Coverity
CID:		1412242
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D23159
This commit is contained in:
Eric van Gyzen 2020-01-13 22:33:48 +00:00
parent da19f62dfa
commit 0ab52bd3eb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356708

View File

@ -76,7 +76,7 @@ __test_ondisk(const hammer_volume_ondisk_t ondisk)
assert(count != 0);
memcpy(&fsid, &ondisk->vol_fsid, sizeof(fsid));
memcpy(&fstype, &ondisk->vol_fstype, sizeof(fstype));
strncpy(label, ondisk->vol_label, sizeof(label));
strlcpy(label, ondisk->vol_label, sizeof(label));
} else {
if (ondisk->vol_count != count)
return (5);
@ -84,7 +84,7 @@ __test_ondisk(const hammer_volume_ondisk_t ondisk)
return (6);
if (memcmp(&ondisk->vol_fstype, &fstype, sizeof(fstype)))
return (7);
if (strncmp(ondisk->vol_label, label, sizeof(label)))
if (strcmp(ondisk->vol_label, label))
return (8);
}