kopia lustrzana https://github.com/OpenRTX/OpenRTX
Fix off-by-one errors
Fixed identical off-by-one errors in blockdevice read function and in linux posix file driver.rtxlink
rodzic
1122cae2fd
commit
c29f271f96
|
@ -37,7 +37,7 @@
|
|||
static inline bool checkBounds(const struct nvmArea *area, uint32_t addr, size_t len)
|
||||
{
|
||||
return (addr >= area->startAddr)
|
||||
&& ((addr + len) < (area->startAddr + area->size));
|
||||
&& ((addr + len) <= (area->startAddr + area->size));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static int nvm_api_read(const struct nvmDevice *dev, uint32_t offset,
|
|||
if(fd < 0)
|
||||
return -EBADF;
|
||||
|
||||
if((offset + len) >= cfg->fileSize)
|
||||
if((offset + len) > cfg->fileSize)
|
||||
return -EINVAL;
|
||||
|
||||
lseek(fd, offset, SEEK_SET);
|
||||
|
|
Ładowanie…
Reference in New Issue