Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at conversation.c:494

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

find_conversation

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/conversation.c)expand/collapse
Show more  
 684  conversation_t *
 685  find_conversation(guint32 frame_num, address *addr_a, address *addr_b, port_type ptype,
 686      guint32 port_a, guint32 port_b, guint options)
 687  {
 688     conversation_t *conversation;
 689   
 690     /*
 691      * First try an exact match, if we have two addresses and ports.
 692      */
 693     if (!(options & (NO_ADDR_B|NO_PORT_B))) {
 694        /*
 695         * Neither search address B nor search port B are wildcarded,
 696         * start out with an exact match.
 697         * Exact matches check both directions.
 698         */
 699        conversation =
 700           conversation_lookup_hashtable(conversation_hashtable_exact,
 701           frame_num, addr_a, addr_b, ptype,
 702           port_a, port_b);
 703        if ((conversation == NULL) && (addr_a->type == AT_FC)) {
 704           /* In Fibre channel, OXID & RXID are never swapped as 
 705            * TCP/UDP ports are in TCP/IP.
 706            */
 707           conversation =
 708              conversation_lookup_hashtable(conversation_hashtable_exact,
 709              frame_num, addr_b, addr_a, ptype,
 710              port_a, port_b);
 711        }
 712        if (conversation != NULL)
 713           return conversation;
 714     }
 715   
 716     /*
 717      * Well, that didn't find anything.  Try matches that wildcard 
 718      * one of the addresses, if we have two ports.
 719      */
 720     if (!(options & NO_PORT_B)) {
 721        /*
 722         * Search port B isn't wildcarded.
 723         *
 724         * First try looking for a conversation with the specified 
 725         * address A and port A as the first address and port, and 
 726         * with any address and the specified port B as the second 
 727         * address and port.
 728         * ("addr_b" doesn't take part in this lookup.)
 729         */
 730        conversation =
 731
801
Show [ Lines 731 to 801 omitted. ]
 802              }
 803              return conversation;
 804           }
 805        }
 806     }
 807   
 808     /*
 809      * Well, that didn't find anything.  Try matches that wildcard 
 810      * one of the ports, if we have two addresses.
 811     */
 812     if (!(options & NO_ADDR_B)) {
 813        /*
 814         * Search address B isn't wildcarded.
 815         *
 816         * First try looking for a conversation with the specified 
 817         * address A and port A as the first address and port, and 
 818         * with the specified address B and any port as the second 
 819         * address and port.
 820         * ("port_b" doesn't take part in this lookup.)
 821         */
 822        conversation =
 823           conversation_lookup_hashtable(conversation_hashtable_no_port2,
 824[+]          frame_num, addr_a, addr_b, ptype, port_a, port_b);
 825        if ((conversation == NULL) && (addr_a->type == AT_FC)) {
 826           /* In Fibre channel, OXID & RXID are never swapped as 
 827            * TCP/UDP ports are in TCP/IP
 828            */
 829           conversation =
 830              conversation_lookup_hashtable(conversation_hashtable_no_port2,
 831              frame_num, addr_b, addr_a, ptype, port_a, port_b);
 832        }
 833        if (conversation != NULL) {
 834           /*
 835            * If search port B isn't wildcarded, and this is for a connection-
 836            * oriented protocol, set the second port for this conversation to
 837            * port B, as that's the port that matched the wildcarded second port
 838            * for this conversation.
 839            *
 840            * (This assumes that, for all connection oriented protocols, the 
 841            * endpoints of a connection have only one port each, i.e. you don't
 842            * get packets in a given direction coming from more than one port,
 843            * unless the CONVERSATION_TEMPLATE option is set.)
 844            */
 845           if (!(conversation->options & NO_PORT_B) && ptype != PT_UDP)
 846           {
 847              if(!(conversation->options & CONVERSATION_TEMPLATE))
 848              {
 849                 conversation_set_port2(conversation, port_b);
 850              }
 851              else 
 852              {
 853                 conversation =
 854[+]                   conversation_create_from_template(conversation, 0, port_b);
expand/collapse

conversation_create_from_template

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/conversation.c)expand/collapse
Show more  
 99  static conversation_t *
 100  conversation_create_from_template(conversation_t *conversation, address *addr2, guint32 port2)
 101  {
 102     /*
 103      * Add a new conversation and keep the conversation template only if the
 104      * CONVERSATION_TEMPLATE bit is set for a connection oriented protocol.
 105      */
 106     if(conversation->options & CONVERSATION_TEMPLATE &&
 107        conversation->key_ptr->ptype != PT_UDP)
 108     {
 109        /*
 110         * Set up a new options mask where the conversation template bit and the 
 111         * bits for absence of a second address and port pair have been removed.
 112         */
 113        conversation_t *new_conversation_from_template;
 114        guint options = conversation->options & ~(CONVERSATION_TEMPLATE | NO_ADDR2 | NO_PORT2);
 115   
 116        /*
 117         * Are both the NO_ADDR2 and NO_PORT2 wildcards set in the options mask?
 118         */
 119        if(conversation->options & NO_ADDR2 &&
 120           conversation->options & NO_PORT2)
 121        {
 122           /*
 123            * The conversation template was created without knowledge of both 
 124            * the second address as well as the second port. Create a new 
 125            * conversation with new 2nd address and 2nd port.
 126            */
 127           new_conversation_from_template =
 128              conversation_new(conversation->setup_frame,
 129                               &conversation->key_ptr->addr1, addr2,
 130                               conversation->key_ptr->ptype, conversation->key_ptr->port1,
 131[+]                              port2, options);
expand/collapse

conversation_new

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/conversation.c)expand/collapse
Show more  
 465  conversation_t *
 466  conversation_new(guint32 setup_frame, address *addr1, address *addr2, port_type ptype,
 467      guint32 port1, guint32 port2, guint options)
 468  {
 469  /*
 470          DISSECTOR_ASSERT(!(options | CONVERSATION_TEMPLATE) || ((options | (NO_ADDR2 | NO_PORT2 | NO_PORT2_FORCE))) &&
 471                                  "A conversation template may not be constructed without wildcard options");
 472  */
 473          GHashTable* hashtable;
 474          conversation_t *conversation;
 475          conversation_t *tc;
 476          conversation_key existing_key;
 477          conversation_key *new_key;
 478   
 479          if (options & NO_ADDR2) {
 480                  if (options & (NO_PORT2|NO_PORT2_FORCE)) {
 481                          hashtable = conversation_hashtable_no_addr2_or_port2;
 482                  } else {
 483                          hashtable = conversation_hashtable_no_addr2;
 484                  }
 485          } else {
 486                  if (options & (NO_PORT2|NO_PORT2_FORCE)) {
 487                          hashtable = conversation_hashtable_no_port2;
 488                  } else {
 489                          hashtable = conversation_hashtable_exact;
 490                  }
 491          }
 492   
 493          existing_key.addr1 = *addr1;
 494          existing_key.addr2 = *addr2;
Show more  
Show more  
Show more  




Change Warning 1222.30752 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: