Fix regexp damage when renaming erecalloc() -> sudo_erecalloc()

This commit is contained in:
Todd C. Miller
2014-06-27 11:48:07 -06:00
parent 2be0929f22
commit d6948f5a4a
2 changed files with 7 additions and 7 deletions

View File

@@ -170,20 +170,20 @@ sudo_ereallocarray(void *ptr, size_t nmemb, size_t size)
} }
/* /*
* sudo_ersudo_ecalloc() realloc(3)s nmemb * msize bytes and exits with an error * sudo_erecalloc() realloc(3)s nmemb * msize bytes and exits with an error
* if overflow would occur or if the system malloc(3)/realloc(3) fails. * if overflow would occur or if the system malloc(3)/realloc(3) fails.
* On success, the new space is zero-filled. You can call sudo_erealloc() * On success, the new space is zero-filled. You can call sudo_erealloc()
* with a NULL pointer even if the system realloc(3) does not support this. * with a NULL pointer even if the system realloc(3) does not support this.
*/ */
void * void *
ersudo_ecalloc(void *ptr, size_t onmemb, size_t nmemb, size_t msize) sudo_erecalloc(void *ptr, size_t onmemb, size_t nmemb, size_t msize)
{ {
size_t size; size_t size;
if (nmemb == 0 || msize == 0) if (nmemb == 0 || msize == 0)
sudo_fatalx_nodebug(_("internal error, tried allocate zero bytes")); sudo_fatalx_nodebug(_("internal error, tried allocate zero bytes"));
if (nmemb > SIZE_MAX / msize) if (nmemb > SIZE_MAX / msize)
sudo_fatalx_nodebug(_("internal error, %s overflow"), "ersudo_ecalloc"); sudo_fatalx_nodebug(_("internal error, %s overflow"), "sudo_erecalloc");
size = nmemb * msize; size = nmemb * msize;
ptr = ptr ? realloc(ptr, size) : malloc(size); ptr = ptr ? realloc(ptr, size) : malloc(size);

View File

@@ -92,10 +92,10 @@ sudo_ev_add_impl(struct sudo_event_base *base, struct sudo_event *ev)
if (ev->fd > base->maxfd) { if (ev->fd > base->maxfd) {
const int o = (base->maxfd + 1) / NFDBITS; const int o = (base->maxfd + 1) / NFDBITS;
const int n = howmany(ev->fd + 1, NFDBITS); const int n = howmany(ev->fd + 1, NFDBITS);
base->readfds_in = ersudo_ecalloc(base->readfds_in, o, n, sizeof(fd_mask)); base->readfds_in = sudo_erecalloc(base->readfds_in, o, n, sizeof(fd_mask));
base->writefds_in = ersudo_ecalloc(base->writefds_in, o, n, sizeof(fd_mask)); base->writefds_in = sudo_erecalloc(base->writefds_in, o, n, sizeof(fd_mask));
base->readfds_out = ersudo_ecalloc(base->readfds_out, o, n, sizeof(fd_mask)); base->readfds_out = sudo_erecalloc(base->readfds_out, o, n, sizeof(fd_mask));
base->writefds_out = ersudo_ecalloc(base->writefds_out, o, n, sizeof(fd_mask)); base->writefds_out = sudo_erecalloc(base->writefds_out, o, n, sizeof(fd_mask));
base->maxfd = (n * NFDBITS) - 1; base->maxfd = (n * NFDBITS) - 1;
} }