This commit is contained in:
Guillem George 2025-11-04 14:38:36 +01:00
commit d0bd16da2f
9 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#include "beware_overflow.h"
void *beware_overflow(void *ptr, size_t nmemb, size_t size)
{
size_t c;
if (__builtin_mul_overflow(nmemb, size, &c))
return NULL;
char *byte_ptr = ptr;
return c + byte_ptr;
}