u413-284-si / webserv

This project is about setting up a http web server, providing a static website.
MIT License
0 stars 0 forks source link

UBSan: reference binding to null pointer of type 'sockaddr' #49

Closed gwolf-011235 closed 2 months ago

gwolf-011235 commented 2 months ago

Functions of SocketPolicy get passed a reference to an struct sockaddr. When using MockSocketPolicy in unittest UBSan (Undefined Behavior Sanitizer) reports error: reference binding to null pointer of type 'sockaddr'. Passing pointers instead does not generate these errors.

It does seem to have something to do how gmock generates the MockSocketPolicy. However it would be nice to be able to easily dinstinguish these errors from other errors.

Therefore function signatures will be changed to receive pointers and assert() will make sure, that no NULL pointer is sent.