Text   |  XML   |  ReML   |   Visible Warnings:

Cast Alters Value  at proto.c:2701

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

dissect_quakeworld_ConnectionlessPacket

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-quakeworld.c)expand/collapse
Show more  
 356  dissect_quakeworld_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo,
 357          proto_tree *tree, int direction)
 358  {
 359          proto_tree      *cl_tree = NULL;
 360          proto_item      *cl_item = NULL;
 361          proto_item      *text_item = NULL;
 362          proto_tree      *text_tree = NULL;
 363          guint8          text[MAX_TEXT_SIZE+1];
 364          int             len;
 365          int             offset;
 366          guint32 marker;
 367          int command_len;
 368          char *command="";
 369          int command_finished = FALSE;
 370   
 371   
 372          marker = tvb_get_ntohl(tvb, 0);
 373          if (tree) {
 374                  cl_item = proto_tree_add_text(tree, tvb,
 375[+]                                 0, -1, "Connectionless");
 376                  if (cl_item)
 377                          cl_tree = proto_item_add_subtree(
 378                                  cl_item, ett_quakeworld_connectionless);
 379          }
 380   
 381          if (cl_tree) {
 382                  proto_tree_add_uint(cl_tree, hf_quakeworld_connectionless_marker,
 383                                  tvb, 0, 4, marker);
 384          }
 385   
 386          /* all the rest of the packet is just text */
 387          offset = 4;
 388   
 389          len = tvb_get_nstringz0(tvb, offset, sizeof(text), text);
 390          /* actually, we should look for a eol char and stop already there */
 391   
 392          if (cl_tree) {
 393                  text_item = proto_tree_add_string(cl_tree, hf_quakeworld_connectionless_text,
 394                          tvb, offset, len + 1, text);
 395                  if (text_item) {
 396                          text_tree = proto_item_add_subtree(
 397                                  text_item, ett_quakeworld_connectionless_text);
 398                  }
 399          }
 400   
 401          if (direction == DIR_C2S) {
 402                  /* client to server commands */
 403                  const char *c;
 404   
 405                  Cmd_TokenizeString(text);
 406                  c = Cmd_Argv(0);
 407   
 408                  /* client to sever commands */
 409                  if (strcmp(c,"ping") == 0) {
 410                          command="Ping";
 411                          command_len = 4;
 412                  } else if (strcmp(c,"status") == 0) {
 413                          command="Status";
 414                          command_len = 6;
 415                  } else if (strcmp(c,"log") == 0) {
 416                          command="Log";
 417                          command_len = 3;
 418                  } else if (strcmp(c,"connect") == 0) {
 419                          int version;
 420                          int qport;
 421                          int challenge;
 422                          const char *infostring;
 423                          proto_item *argument_item = NULL;
 424                          proto_tree *argument_tree = NULL;
 425                          proto_item *info_item = NULL;
 426                          proto_tree *info_tree = NULL;
 427                          command="Connect";
 428                          command_len = Cmd_Argv_length(0);
 429                          if (text_tree) {
 430                                  proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
 431                                          tvb, offset, command_len, command);
 432                                  argument_item = proto_tree_add_string(text_tree,
 433                                          hf_quakeworld_connectionless_arguments,
 434                                          tvb, offset + Cmd_Argv_start(1), len + 1 - Cmd_Argv_start(1),
 435                                          text + Cmd_Argv_start(1));
 436                                  if (argument_item) {
 437                                          argument_tree =
 438                                                  proto_item_add_subtree(argument_item,
 439                                                          ett_quakeworld_connectionless_arguments);
 440                                  }
 441                                  command_finished=TRUE;
 442                          }
 443                          version = atoi(Cmd_Argv(1));
 444                          qport = atoi(Cmd_Argv(2));
 445                          challenge = atoi(Cmd_Argv(3));
 446                          infostring = Cmd_Argv(4);
 447                          if (argument_tree) {
 448                                  proto_tree_add_uint(argument_tree,
 449                                          hf_quakeworld_connectionless_connect_version,
 450                                          tvb,
 451                                          offset + Cmd_Argv_start(1),
 452                                          Cmd_Argv_length(1), version);
 453                                  proto_tree_add_uint(argument_tree,
 454                                          hf_quakeworld_connectionless_connect_qport,
 455                                          tvb,
 456                                          offset + Cmd_Argv_start(2),
 457                                          Cmd_Argv_length(2), qport);
 458                                  proto_tree_add_int(argument_tree,
 459                                          hf_quakeworld_connectionless_connect_challenge,
 460                                          tvb,
 461                                          offset + Cmd_Argv_start(3),
 462[+]                                         Cmd_Argv_length(3), challenge);
expand/collapse

proto_tree_add_int

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.c)expand/collapse
Show more  
 2626  proto_item *
 2627  proto_tree_add_int(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length,
 2628                  gint32 value)
 2629  {
 2630          proto_item              *pi = NULL;
 2631          field_info              *new_fi;
 2632          header_field_info       *hfinfo;
 2633   
 2634          if (!tree)
 2635                  return (NULL);
 2636   
 2637          TRY_TO_FAKE_THIS_ITEM(tree, hfindex);
 2638   
 2639          PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo);
 2640          switch(hfinfo->type) {
 2641                  case FT_INT8:
 2642                  case FT_INT16:
 2643                  case FT_INT24:
 2644                  case FT_INT32:
 2645                          pi = proto_tree_add_pi(tree, hfindex, tvb, start, &length,
 2646                                          &new_fi);
 2647[+]                         proto_tree_set_int(new_fi, value);
expand/collapse

proto_tree_set_int

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.c)expand/collapse
Show more  
 2695  proto_tree_set_int(field_info *fi, gint32 value)
 2696  {
 2697          header_field_info       *hfinfo;
 2698          guint32                 integer;
 2699   
 2700          hfinfo = fi->hfinfo;
 2701          integer = (guint32) value;
Show more  
Show more  
Show more  




Change Warning 2905.31324 : Cast Alters Value

Priority:
State:
Finding:
Owner:
Note: