1
0
mirror of https://github.com/CovidBraceletPrj/CovidBracelet.git synced 2024-10-31 17:08:43 +01:00

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

View File

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