summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiung <jiung.yu@samsung.com>2017-09-28 11:34:53 +0900
committerchleun.moon <chleun.moon@samsung.com>2017-09-28 13:27:27 +0900
commit64966189d2022e1ed201c06248516bad6106715a (patch)
tree966d04906a81ba1272ce0e419414c5a2d4139959
parent3ff23b8470200ce6c0753422e61bf1cccdefdf55 (diff)
downloadtoybox-accepted/tizen_4.0_unified.tar.gz
toybox-accepted/tizen_4.0_unified.tar.bz2
toybox-accepted/tizen_4.0_unified.zip
Change-Id: Ida9d618ce50bed3500414cd3752d7999c338468c Signed-off-by: Yu jiung <jiung.yu@samsung.com>
-rw-r--r--toys/samsung/nslookup.c9
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));