mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-25 10:40:25 +00:00
Add xallocarray() helper macro
Uses reallocarray to perform integer overflow detection when allocating an array, using NULL as the previous pointer to force a new allocation. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
@@ -74,6 +74,8 @@ typedef struct _NewClientRec *NewClientPtr;
|
||||
|
||||
#define xstrdup(s) Xstrdup(s)
|
||||
#define xnfstrdup(s) XNFstrdup(s)
|
||||
|
||||
#define xallocarray(num, size) reallocarray(NULL, (num), (size))
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
Reference in New Issue
Block a user