projects
/
oweals
/
gnunet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e938b86
)
fix #6189
author
Christian Grothoff
<christian@grothoff.org>
Tue, 21 Apr 2020 11:33:25 +0000
(13:33 +0200)
committer
Christian Grothoff
<christian@grothoff.org>
Tue, 21 Apr 2020 11:33:25 +0000
(13:33 +0200)
src/include/gnunet_common.h
patch
|
blob
|
history
diff --git
a/src/include/gnunet_common.h
b/src/include/gnunet_common.h
index 9e7c77786b24278bfe47b7b4d5598871e0677c92..fcc510ec9f229589f08b6ec7fecd9b31295da50d 100644
(file)
--- a/
src/include/gnunet_common.h
+++ b/
src/include/gnunet_common.h
@@
-1209,7
+1209,10
@@
GNUNET_is_zero_ (const void *a,
* @param n number of elements in the array
* @param type name of the struct or union, i.e. pass 'struct Foo'.
*/
-#define GNUNET_new_array(n, type) (type *) GNUNET_malloc ((n) * sizeof(type))
+#define GNUNET_new_array(n, type) ({ \
+ GNUNET_assert (SIZE_MAX / sizeof (type) >= n); \
+ (type *) GNUNET_malloc ((n) * sizeof(type)); \
+ })
/**
* @ingroup memory