make sure no unitialized memory is accessed in the sockaddr_un structure

This commit is contained in:
Thomas Bernard 2017-01-09 10:16:29 +01:00
parent c8b42602a2
commit 8c9ce4dbb4
1 changed files with 2 additions and 1 deletions

View File

@ -3,7 +3,7 @@
* Project : miniupnp
* Web : http://miniupnp.free.fr/
* Author : Thomas BERNARD
* copyright (c) 2005-2016 Thomas Bernard
* copyright (c) 2005-2017 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENCE file. */
/*#include <syslog.h>*/
@ -201,6 +201,7 @@ connectToMiniSSDPD(const char * socketpath)
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
if(!socketpath)
socketpath = "/var/run/minissdpd.sock";
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, socketpath, sizeof(addr.sun_path));
/* TODO : check if we need to handle the EINTR */