mirror of https://github.com/google/oss-fuzz.git
Add wrappers for getpwnam and getgrnam (#4419)
This commit is contained in:
parent
e036c4fa32
commit
1b7b334da7
|
@ -24,7 +24,7 @@ rm -rf genfiles && mkdir genfiles && $SRC/LPM/external.protobuf/bin/protoc http_
|
|||
cd ../..
|
||||
|
||||
auto/configure \
|
||||
--with-ld-opt="-Wl,--wrap=listen -Wl,--wrap=setsockopt -Wl,--wrap=bind -Wl,--wrap=shutdown -Wl,--wrap=connect" \
|
||||
--with-ld-opt="-Wl,--wrap=listen -Wl,--wrap=setsockopt -Wl,--wrap=bind -Wl,--wrap=shutdown -Wl,--wrap=connect -Wl,--wrap=getpwnam -Wl,--wrap=getgrnam" \
|
||||
--with-http_v2_module
|
||||
make -f objs/Makefile fuzzers
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
|
||||
int __wrap_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
|
||||
return 0;
|
||||
|
@ -32,3 +34,15 @@ int __wrap_setsockopt(int fd, int level, int optname, const void *optval,
|
|||
socklen_t optlen) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct passwd *__wrap_getpwnam(const char *name){
|
||||
struct passwd *pwd = (struct passwd *) calloc(1, sizeof(struct passwd));
|
||||
pwd->pw_uid = 1;
|
||||
return pwd;
|
||||
}
|
||||
|
||||
struct group *__wrap_getgrnam(const char *name){
|
||||
struct group *grp = (struct group *) calloc(1, sizeof(struct group));
|
||||
grp->gr_gid = 1;
|
||||
return grp;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue