From d647d6c4fac6beb9c494f6b4e4b051675f0645ce Mon Sep 17 00:00:00 2001 From: "chleun.moon" Date: Thu, 28 Sep 2017 14:14:19 +0900 Subject: [PATCH] [CID-24737, 27526, 31321] Fix bugs Change-Id: I38e98e9cc89b0be19d4d8237c503ba1370acb219 Signed-off-by: Cheoleun Moon --- packaging/capi-network-nsd.spec | 2 +- src/dns-sd/dns-sd.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packaging/capi-network-nsd.spec b/packaging/capi-network-nsd.spec index 110ee12..160f631 100644 --- a/packaging/capi-network-nsd.spec +++ b/packaging/capi-network-nsd.spec @@ -1,6 +1,6 @@ Name: capi-network-nsd Summary: A Network Service Discovery libraries in Native API -Version: 0.0.16 +Version: 0.0.17 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/dns-sd/dns-sd.c b/src/dns-sd/dns-sd.c index 3cade00..55b6671 100644 --- a/src/dns-sd/dns-sd.c +++ b/src/dns-sd/dns-sd.c @@ -216,6 +216,11 @@ void __dnssd_handle_events(int *watch_id, DNSServiceRef *sdRef) GIOChannel *sock_io = NULL; int dns_sd_fd = DNSServiceRefSockFD(*sdRef); + if (dns_sd_fd < 0) { + DNSSD_LOGE("Invalid socket fd"); + return; + } + sock_io = g_io_channel_unix_new(dns_sd_fd); g_io_channel_set_flags(sock_io, G_IO_FLAG_NONBLOCK, NULL); g_io_channel_set_close_on_unref(sock_io, TRUE); @@ -1066,6 +1071,10 @@ static int __dnssd_getaddrinfo(dnssd_handle_s *dnssd_handle, unsigned int flags, /* fullname is of the form .. * Extract servicename and domain from fullname */ name = g_strdup(fullname); + if (name == NULL) { + DNSSD_LOGE("Invalid browse handle"); + return DNSSD_ERROR_OPERATION_FAILED; + } domain = strtok_r(name, ".", &save_str); domain = strtok_r(NULL, ".", &save_str); domain = strtok_r(NULL, ".", &save_str); @@ -1431,6 +1440,7 @@ int dnssd_start_browsing_service_on_interface(const char *service_type, const ch if ((if_index = if_nametoindex(interface)) == 0) { DNSSD_LOGE("Invalid interface name"); + g_free(local_handle); //LCOV_EXCL_LINE __DNSSD_LOG_FUNC_EXIT__; return DNSSD_ERROR_INVALID_PARAMETER; } -- 2.7.4