[riot-notifications] [RIOT-OS/RIOT] drivers/mtd: Prevent potential heap overflow (#16816)

benpicco notifications at github.com
Tue Sep 7 09:19:13 CEST 2021

@benpicco commented on this pull request.

> @@ -167,11 +167,16 @@ int mtd_write_page(mtd_dev_t *mtd, const void *data, uint32_t page,
         return res;
+    /* prevent heap overflow of work buffer */
+    if (count + offset > sector_size) {

Yes you are right. But we should check this *before* erasing the page. 

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210907/5634c4fe/attachment.htm>

More information about the notifications mailing list