Use primary router when sending WHOIS packet if client->router is NULL.
authorSkywing <skywing@valhallalegends.com>
Sun, 23 Nov 2008 18:54:12 +0000 (13:54 -0500)
committerSkywing <skywing@valhallalegends.com>
Sun, 23 Nov 2008 19:34:13 +0000 (14:34 -0500)
client may be non-NULL, but client->router may be NULL when we enter
silc_server_query_client in the case of a detached client on a remote
server that has not been fully resolved yet.  In this case, we should
try and send the packet using the primary router.  This fixes a crash
wherein silc_server_query_client would sometimes crash with a NULL
dereference if called on a remote detached client.

apps/silcd/server_query.c

index 59eda8024e40cb5d513ef8bc89656311bb9b7150..968e0ca38adb0289e2d0501890dfdc759cc3ac3d 100644 (file)
@@ -2182,7 +2182,8 @@ SilcClientEntry silc_server_query_client(SilcServer server,
                                            server->cmd_ident, 1,
                                            4, idp->data,
                                            silc_buffer_len(idp));
-    silc_server_packet_send(server, client ? client->router->connection :
+    silc_server_packet_send(server,
+                           client && client->router ? client->router->connection :
                            SILC_PRIMARY_ROUTE(server),
                            SILC_PACKET_COMMAND, 0,
                            buffer->data, silc_buffer_len(buffer));