From: Alejandro Colomar Date: Sat, 4 Feb 2023 22:20:38 +0000 (+0100) Subject: Use reallocarray(3) instead of its pattern X-Git-Tag: 4.14.0-rc1~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1aa22c14674e14e84efa171614dea2b515d5a223;p=thirdparty%2Fshadow.git Use reallocarray(3) instead of its pattern Signed-off-by: Alejandro Colomar --- diff --git a/libmisc/env.c b/libmisc/env.c index 859dca08a..eba365ae8 100644 --- a/libmisc/env.c +++ b/libmisc/env.c @@ -127,15 +127,14 @@ void addenv (const char *string, /*@null@*/const char *value) if ((newenvc & (NEWENVP_STEP - 1)) == 0) { char **__newenvp; - size_t newsize; /* * If the resize operation succeeds we can * happily go on, else print a message. */ - newsize = (newenvc + NEWENVP_STEP) * sizeof (char *); - __newenvp = (char **) realloc (newenvp, newsize); + __newenvp = (char **) reallocarray (newenvp, newenvc + NEWENVP_STEP, + sizeof (char *)); if (NULL != __newenvp) { /*