diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-21 13:33:25 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-21 13:33:25 +0200 |
commit | 3776e3a77bff3f3d7091e91aac2e1b6b3425b28d (patch) | |
tree | 558afb2b21de153b023bfd399c64f2a97557642c /src/include/gnunet_common.h | |
parent | e938b8617332a9d04c1620a6a93e25478410d98b (diff) | |
download | gnunet-3776e3a77bff3f3d7091e91aac2e1b6b3425b28d.tar.gz gnunet-3776e3a77bff3f3d7091e91aac2e1b6b3425b28d.zip |
fix #6189
Diffstat (limited to 'src/include/gnunet_common.h')
-rw-r--r-- | src/include/gnunet_common.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 9e7c77786..fcc510ec9 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -1209,7 +1209,10 @@ GNUNET_is_zero_ (const void *a, | |||
1209 | * @param n number of elements in the array | 1209 | * @param n number of elements in the array |
1210 | * @param type name of the struct or union, i.e. pass 'struct Foo'. | 1210 | * @param type name of the struct or union, i.e. pass 'struct Foo'. |
1211 | */ | 1211 | */ |
1212 | #define GNUNET_new_array(n, type) (type *) GNUNET_malloc ((n) * sizeof(type)) | 1212 | #define GNUNET_new_array(n, type) ({ \ |
1213 | GNUNET_assert (SIZE_MAX / sizeof (type) >= n); \ | ||
1214 | (type *) GNUNET_malloc ((n) * sizeof(type)); \ | ||
1215 | }) | ||
1213 | 1216 | ||
1214 | /** | 1217 | /** |
1215 | * @ingroup memory | 1218 | * @ingroup memory |