Shouldn't you zero initialize the socket99_cfg struct before using it to avoid garbage data?
zeeman opened this issue · comments
So just from a quick look at this code, I'm wondering how exactly you avoid situations where the socket99_cfg struct is polluted with garbage data. In the socket99_open
function, it's assumed that cfg->path
will be NULL if the user doesn't want to make a UNIX domain socket, but if there's garbage data in the cfg->path
member, would that not cause it to accidentally try creating a UNIX domain socket instead?
It's unnecessary in C99. If the suggested initialization style is used, any fields which are not explicitly initialized are set to 0, and fields set to 0 are internally set to reasonable defaults by the library.
See this blog post for more details.