brainboxdotcc / DPP

C++ Discord API Bot Library - D++ is Lightweight and scalable for small and huge bots!
https://dpp.dev/
Apache License 2.0
1.04k stars 158 forks source link

fix: out-of-bounds read of MIME types #1104

Closed VoltrexKeyva closed 5 months ago

VoltrexKeyva commented 5 months ago

Since i is the index, it should be less than the size of the vector but the mimetypes.size() < i condition does not check for i being the same as the size of the vector, which causes an out-of-bounds read in the right operand of the logical OR (||) operator which is mimetypes[i].empty().

Code change checklist

netlify[bot] commented 5 months ago

Deploy Preview for dpp-dev ready!

Name Link
Latest commit 646c11f5b88c540f935a277434430a542365ccfb
Latest deploy log https://app.netlify.com/sites/dpp-dev/deploys/65e5ca0a27c27d0008cdcc11
Deploy Preview https://deploy-preview-1104--dpp-dev.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

braindigitalis commented 5 months ago

no, i dont think this fix is right!

vectors are 0-based so its 0 thru n - 1, if you try to access n, this indeed would then be out of bounds...

braindigitalis commented 5 months ago

thanks, i'll merge it as is :)