From: Vyacheslav Cherkashin Date: Fri, 10 Oct 2014 08:22:53 +0000 (+0400) Subject: [FIX] NULL pointer dereference crash X-Git-Tag: Tizen_SDK_2.3~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=227c383b1a67f9b1dba377aaf18a35907f61761b;p=platform%2Fcore%2Fsystem%2Fswap-probe.git [FIX] NULL pointer dereference crash Change-Id: Id86aa50192f2bd0e5efc32934b4685f487d9a331 Signed-off-by: Vyacheslav Cherkashin --- diff --git a/probe_socket/libdasocket.c b/probe_socket/libdasocket.c index fe594f7..abe79c8 100644 --- a/probe_socket/libdasocket.c +++ b/probe_socket/libdasocket.c @@ -60,6 +60,12 @@ void getAddress(const struct sockaddr *sa, char *address) { char buff[INET6_ADDRSTRLEN]; char *path; + if (sa == NULL) { + const char sa_is_null[] = ""; + memcpy(address, sa_is_null, sizeof(sa_is_null)); + return; + } + switch (sa->sa_family) { case AF_INET: snprintf(address, MAX_PATH_LENGTH, "%s:%d", @@ -84,7 +90,6 @@ void getAddress(const struct sockaddr *sa, char *address) { sa->sa_family); break; } - } //FD