fix: the bug about rwbuffer causing mem overflow

when the offest from rwb->wrblockstart to startblock
plus rwb->wrnblocks is greater than rwb->wralignblocks,
it will be causing memory overflow since rwb->wrbuffer is
allocated rwb.wrmaxblock(rwb.wralignblocks) blocks.
This commit is contained in:
ChenChuang 2024-04-14 14:59:41 +08:00 committed by Alan Carvalho de Assis
parent ebcf25b2f6
commit e43aa99ae8

View File

@ -819,7 +819,7 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
/* Allocate the write buffer */
allocsize = rwb->wrmaxblocks * rwb->blocksize;
allocsize = rwb->wrmaxblocks * rwb->blocksize * 2;
rwb->wrbuffer = kmm_malloc(allocsize);
if (!rwb->wrbuffer)
{