nfs4: Ensure that a string is NULL terminated after strncpy()

This fixes CID 990971.
This commit is contained in:
Pawel Dziepak
2013-03-19 01:24:00 +01:00
parent 62e43541d7
commit e975b31db3
@@ -135,7 +135,8 @@ RootInode::_UpdateInfo(bool force)
|| fFileSystem->GetConfiguration().fEmulateNamedAttrs)
fInfoCache.flags |= B_FS_HAS_MIME | B_FS_HAS_ATTR;
strncpy(fInfoCache.volume_name, fName, B_FILE_NAME_LENGTH);
strncpy(fInfoCache.volume_name, fName, sizeof(fInfoCache.volume_name));
fInfoCache.volume_name[sizeof(fInfoCache.volume_name) - 1] = '\0';
fInfoCacheExpire = time(NULL) + MetadataCache::kExpirationTime;