Skip to content

Commit b61c81c

Browse files
authored
Replace reallocarray with safe_perealloc (#9593)
1 parent 49499c5 commit b61c81c

File tree

4 files changed

+3
-50
lines changed

4 files changed

+3
-50
lines changed

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ if test "$ac_cv_func_getaddrinfo" = yes; then
695695
AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
696696
fi
697697

698-
AC_REPLACE_FUNCS(strlcat strlcpy explicit_bzero getopt reallocarray)
698+
AC_REPLACE_FUNCS(strlcat strlcpy explicit_bzero getopt)
699699
AC_FUNC_ALLOCA
700700
PHP_TIME_R_TYPE
701701
PHP_CHECK_IN_ADDR_T
@@ -1622,7 +1622,7 @@ PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c \
16221622
php_ini_builder.c \
16231623
php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
16241624
strlcat.c explicit_bzero.c reentrancy.c php_variables.c php_ticks.c \
1625-
network.c php_open_temporary_file.c php_odbc_utils.c safe_bcmp.c reallocarray.c \
1625+
network.c php_open_temporary_file.c php_odbc_utils.c safe_bcmp.c \
16261626
output.c getopt.c php_syslog.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
16271627

16281628
PHP_ADD_SOURCES_X(main, fastcgi.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_FASTCGI_OBJS, no)

main/php.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,6 @@ END_EXTERN_C()
179179
#define explicit_bzero php_explicit_bzero
180180
#endif
181181

182-
#ifndef HAVE_REALLOCARRAY
183-
BEGIN_EXTERN_C()
184-
PHPAPI void* php_reallocarray(void *p, size_t nmb, size_t siz);
185-
END_EXTERN_C()
186-
#undef reallocarray
187-
#define reallocarray php_reallocarray
188-
#endif
189-
190182
BEGIN_EXTERN_C()
191183
PHPAPI int php_safe_bcmp(const zend_string *a, const zend_string *b);
192184
END_EXTERN_C()

main/reallocarray.c

Lines changed: 0 additions & 39 deletions
This file was deleted.

sapi/fpm/fpm/fpm_arrays.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static inline void *fpm_array_push(struct fpm_array_s *a) /* {{{ */
8686

8787
if (a->used == a->allocated) {
8888
size_t new_allocated = a->allocated ? a->allocated * 2 : 20;
89-
void *new_ptr = reallocarray(a->data, a->sz, new_allocated);
89+
void *new_ptr = safe_perealloc(a->data, a->sz, new_allocated, 0, true);
9090

9191
if (!new_ptr) {
9292
return 0;

0 commit comments

Comments
 (0)