Skip to content

Commit

Permalink
Merge pull request fte-team#180 from fhomolka/plug_bullet_build_fix
Browse files Browse the repository at this point in the history
[Minor] Fix plugin.c failing when building Bullet Plugin
  • Loading branch information
eukara committed Jun 2, 2023
2 parents d76d142 + 9da0319 commit 7604e8e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion plugins/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,31 @@ qboolean ZF_ReallocElements(void **ptr, size_t *elements, size_t newelements, si

//protect against malicious overflows
if (newelements > SIZE_MAX / elementsize)
#ifdef __cplusplus
return qfalse;
#else
return false;
#endif

oldsize = *elements * elementsize;
newsize = newelements * elementsize;

n = plugfuncs->Realloc(*ptr, newsize);
if (!n)
#ifdef __cplusplus
return qfalse;
#else
return false;
#endif
if (newsize > oldsize)
memset((char*)n+oldsize, 0, newsize - oldsize);
*elements = newelements;
*ptr = n;
return true;
#ifdef __cplusplus
return qtrue;
#else
return true;
#endif
}


Expand Down

0 comments on commit 7604e8e

Please sign in to comment.