SocketPolicy is a wrapper around socket related functions like getaddrinfo. The wrapper functions had references passed to struct addrinfo.
In tests MockSocketPolicy is used. In this tests dummy struct addrinfo are created. These structs also have a pointer to a struct sockaddr, which was init to NULL (since not used anyway). But this lead to passing a reference to NULL which was caught by UBSan as undefine behavior.
Changes:
To avoid generating reference to NULL the functions now take a pointer and have an assert(ptr != NULL)
The testcases create dummy addrinfo with a dummy sockaddr added, so no NULL pointers are sent
SocketPolicy is a wrapper around socket related functions like getaddrinfo. The wrapper functions had references passed to struct addrinfo.
In tests MockSocketPolicy is used. In this tests dummy struct addrinfo are created. These structs also have a pointer to a struct sockaddr, which was init to NULL (since not used anyway). But this lead to passing a reference to NULL which was caught by UBSan as undefine behavior.
Changes: