diff options
Diffstat (limited to 'toys/samsung/nslookup.c')
-rw-r--r-- | toys/samsung/nslookup.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/toys/samsung/nslookup.c b/toys/samsung/nslookup.c index b83ff97..bab44b9 100644 --- a/toys/samsung/nslookup.c +++ b/toys/samsung/nslookup.c @@ -100,10 +100,11 @@ static void resolve_addr(char *host, void *addr, char* port) if(ret <0 || ret > 65535 ) error_exit("bad port: %s", port); if (strncmp(host, "local:", 6) == 0) { - struct sockaddr *sockun = (struct sockaddr *)addr; - sockun->sa_family = AF_UNIX; - strncpy(((struct sockaddr_un *)sockun)->sun_path, host + 6, - sizeof(((struct sockaddr_un *)sockun)->sun_path)); + struct sockaddr_un *sockun = (struct sockaddr_un *)addr; + struct sockaddr *sock = (struct sockaddr *)addr; + sock->sa_family = AF_UNIX; + strncpy(sockun->sun_path, host + 6, sizeof(sockun->sun_path)); + sockun->sun_path[sizeof(sockun->sun_path) - 1] = '\0'; return ; } memset(&hint, 0, sizeof(hint)); |