Code auditing weekend results and fixes committing.
[silc.git] / lib / silcclient / command.c
index bed9099548068f9ae7e1c5be52f4c4c29b74e572..97d074822e6621e51f14714b116e7c734836ca2f 100644 (file)
@@ -78,14 +78,15 @@ SilcClientCommand silc_command_list[] =
    encoded into correct form in correct order. */
 
 void silc_client_send_command(SilcClient client, SilcClientConnection conn,
-                             SilcCommand command, unsigned int argc, ...)
+                             SilcCommand command, unsigned short ident,
+                             unsigned int argc, ...)
 {
   SilcBuffer packet;
   va_list ap;
 
   va_start(ap, argc);
 
-  packet = silc_command_payload_encode_vap(command, 0, argc, ap);
+  packet = silc_command_payload_encode_vap(command, ident, argc, ap);
   silc_client_packet_send(client, conn->sock, SILC_PACKET_COMMAND, 
                          NULL, 0, NULL, NULL, packet->data, 
                          packet->len, TRUE);
@@ -588,7 +589,13 @@ SILC_CLIENT_CMD_FUNC(ping)
                          0, NULL, NULL, buffer->data, buffer->len, TRUE);
   silc_buffer_free(buffer);
 
-  id = silc_id_str2id(conn->remote_id_data, SILC_ID_SERVER);
+  id = silc_id_str2id(conn->remote_id_data, conn->remote_id_data_len,
+                     SILC_ID_SERVER);
+  if (!id) {
+    SILC_NOT_CONNECTED(cmd->client, cmd->conn);
+    COMMAND_ERROR;
+    goto out;
+  }
 
   /* Start counting time */
   for (i = 0; i < conn->ping_count; i++) {