]> granicus.if.org Git - p11-kit/commitdiff
server: Avoid null-dereference of timespec value on timeout
authorDaiki Ueno <dueno@redhat.com>
Wed, 17 Jan 2018 12:23:28 +0000 (13:23 +0100)
committerDaiki Ueno <ueno@gnu.org>
Wed, 17 Jan 2018 12:49:14 +0000 (13:49 +0100)
Spotted by clang-analyzer.

p11-kit/server.c

index b86d42400417d6319c1c112ffb2720625d2dcd4b..d8ffd78e8c614104cd58740c31859477cc2bbf18 100644 (file)
@@ -418,7 +418,8 @@ server_loop (Server *server,
                if (ret == -1 && errno == EINTR)
                        continue;
 
-               if (ret == 0 && children_avail == 0) { /* timeout */
+               /* timeout */
+               if (ret == 0 && children_avail == 0 && timeout != NULL) {
                        p11_message ("no connections to %s for %lu secs, exiting", server->socket_name, timeout->tv_sec);
                        break;
                }