ENS_FS: Only copy memory if read entry is valid

This commit is contained in:
H1ghBre4k3r 2021-05-14 00:34:48 +02:00 committed by Patrick Rathje
parent 796cf0f089
commit b90c8d7ec6
1 changed files with 2 additions and 1 deletions

View File

@ -90,10 +90,11 @@ int ens_fs_read(ens_fs_t* fs, uint64_t id, void* dest) {
if (!isNotDeleted) {
// entry got deleted
rc = -ENS_DELENT;
goto end;
}
end:
memcpy(dest, obj, fs->entry_size);
end:
k_mutex_unlock(&fs->ens_fs_lock);
return rc;
}