diff options
Diffstat (limited to 'gl/reallocarray.c')
-rw-r--r-- | gl/reallocarray.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gl/reallocarray.c b/gl/reallocarray.c index 1fb2f3c..70c1b47 100644 --- a/gl/reallocarray.c +++ b/gl/reallocarray.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* reallocarray function that is glibc compatible. | 1 | /* reallocarray function that is glibc compatible. |
2 | 2 | ||
3 | Copyright (C) 2017-2021 Free Software Foundation, Inc. | 3 | Copyright (C) 2017-2022 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -19,16 +19,15 @@ | |||
19 | 19 | ||
20 | #include <config.h> | 20 | #include <config.h> |
21 | 21 | ||
22 | #include <stdckdint.h> | ||
22 | #include <stdlib.h> | 23 | #include <stdlib.h> |
23 | #include <errno.h> | 24 | #include <errno.h> |
24 | 25 | ||
25 | #include "intprops.h" | ||
26 | |||
27 | void * | 26 | void * |
28 | reallocarray (void *ptr, size_t nmemb, size_t size) | 27 | reallocarray (void *ptr, size_t nmemb, size_t size) |
29 | { | 28 | { |
30 | size_t nbytes; | 29 | size_t nbytes; |
31 | if (INT_MULTIPLY_WRAPV (nmemb, size, &nbytes)) | 30 | if (ckd_mul (&nbytes, nmemb, size)) |
32 | { | 31 | { |
33 | errno = ENOMEM; | 32 | errno = ENOMEM; |
34 | return NULL; | 33 | return NULL; |