diff options
author | Jiung <jiung.yu@samsung.com> | 2017-09-28 11:34:53 +0900 |
---|---|---|
committer | chleun.moon <chleun.moon@samsung.com> | 2017-09-28 13:27:27 +0900 |
commit | 64966189d2022e1ed201c06248516bad6106715a (patch) | |
tree | 966d04906a81ba1272ce0e419414c5a2d4139959 | |
parent | 3ff23b8470200ce6c0753422e61bf1cccdefdf55 (diff) | |
download | toybox-accepted/tizen_4.0_unified.tar.gz toybox-accepted/tizen_4.0_unified.tar.bz2 toybox-accepted/tizen_4.0_unified.zip |
Fix defect detected by static analyzertizen_4.0.m2_releasetizen_4.0.IoT.p2_releasetizen_4.0.IoT.p1_releasesubmit/tizen_4.0/20170928.232552accepted/tizen/4.0/unified/20170929.080620tizen_4.0_tvtizen_4.0accepted/tizen_4.0_unified
Change-Id: Ida9d618ce50bed3500414cd3752d7999c338468c
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
-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)); |