coverity 181575: check vhost iface non-null if using via bind_iface
authorAndy Green <andy@warmcat.com>
Wed, 19 Jul 2017 06:16:32 +0000 (14:16 +0800)
committerAndy Green <andy@warmcat.com>
Wed, 19 Jul 2017 06:16:32 +0000 (14:16 +0800)
lib/lws-plat-unix.c

index 07b7edc..28e5bbe 100644 (file)
@@ -256,7 +256,7 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
        }
 
 #if defined(SO_BINDTODEVICE)
-       if (vhost->bind_iface) {
+       if (vhost->bind_iface && vhost->iface) {
                lwsl_info("binding listen skt to %s using SO_BINDTODEVICE\n", vhost->iface);
                if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, vhost->iface,
                                strlen(vhost->iface)) < 0) {