2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Add a stub getaddrinfo(3) to avoid a DNS timeout in CIfuzz.

This commit is contained in:
Todd C. Miller
2021-02-25 21:12:03 -07:00
parent 8b545e561c
commit 3fc5932be0

View File

@@ -16,6 +16,8 @@
#include <config.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -29,8 +31,12 @@
#endif
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <unistd.h>
#include <string.h>
#ifndef HAVE_GETADDRINFO
# include "compat/getaddrinfo.h"
#endif
#include "sudoers.h"
#include "interfaces.h"
@@ -140,6 +146,19 @@ fuzz_hook_stub(struct sudo_hook *hook)
return 0;
}
int
#ifdef HAVE_GETADDRINFO
getaddrinfo(
#else
sudo_getaddrinfo(
#endif
const char *nodename, const char *servname,
const struct addrinfo *hints, struct addrinfo **res)
{
/* Stub getaddrinfo(3) to avoid a DNS timeout in CIfuzz. */
return EAI_FAIL;
}
int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{