<h3>Contribution description</h3>
<p>This PR adds a check to <code>drivers/mtd/mtd.c</code> to prevent  a heap overflow of the internal work buffer.<br>
Additional it slightly improves the documentation in <code>mtd.h</code>.</p>

<h3>Testing procedure</h3>
<p>A test was added to <code>tests/mtd_raw</code> to check if the potential heap overflow is handled correctly.</p>



<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/16816'>https://github.com/RIOT-OS/RIOT/pull/16816</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>drivers/mtd: add check for heap overflow, improve documentation</li>
  <li>drivers/mtd: uncrustify files</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16816/files#diff-28f4749f7c6e57f9fcb925211b7ebac0fdc98254bda2a48342a8bff5db51c744">drivers/include/mtd.h</a>
    (32)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16816/files#diff-5780586bcf14210ff12449ee599d066dbbddb1433f9e2d458e9a55611c05ade8">drivers/mtd/mtd.c</a>
    (41)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16816/files#diff-bd827a47489d33d8bd01f4af27a6ee85879a2824edeb99e37c183fb8cda6b918">tests/mtd_raw/main.c</a>
    (58)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16816.patch'>https://github.com/RIOT-OS/RIOT/pull/16816.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16816.diff'>https://github.com/RIOT-OS/RIOT/pull/16816.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/16816">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYBWSFOSVLNSYWWNUULUATDGLANCNFSM5DQQ6U5A">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/ABE7WYCQVGW4NZPQYW2ITXLUATDGLA5CNFSM5DQQ6U5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4OXWEXCQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/16816",
"url": "https://github.com/RIOT-OS/RIOT/pull/16816",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>