[CID-24737, 27526, 31321] Fix bugs 84/153184/1 accepted/tizen/unified/20170929.081859 submit/tizen/20170928.232941
authorchleun.moon <chleun.moon@samsung.com>
Thu, 28 Sep 2017 05:14:19 +0000 (14:14 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Thu, 28 Sep 2017 05:14:27 +0000 (14:14 +0900)
Change-Id: I38e98e9cc89b0be19d4d8237c503ba1370acb219
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
packaging/capi-network-nsd.spec
src/dns-sd/dns-sd.c

index 110ee1208cf784cb004fb791d44e6d33f1ee44c5..160f6316f52116d70ba686c282d3c3795c32f919 100644 (file)
@@ -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
index 3cade000ba5b076a7b39453c272889d0e68b39e4..55b6671fcc3e05d356bb9eeded9612627d10d230 100644 (file)
@@ -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 <servicename>.<protocol>.<domain>
         * 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;
        }