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 <[email protected]> Reviewed-by: Matt Turner <[email protected]> --- include/os.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/os.h b/include/os.h index ffa5f39..2633741 100644 --- a/include/os.h +++ b/include/os.h @@ -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> -- 1.7.9.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
