Skip to content

Potential Bug in ofp_in_pcb.c #231

Open

Description

@HsuJv

Hi team

In file ofp/src/ofp_in_pcb.c: ofp_in_pcbinfo_init

we've got

if (strcmp(name, "tcp") == 0) {  
        pcbinfo->ipi_hashbase = shm_tcp->ofp_hashtbl;  
        ofp_tcp_hashinit(hash_nelements, &pcbinfo->ipi_hashmask,  
            pcbinfo->ipi_hashbase);  
  
        pcbinfo->ipi_porthashbase = shm_tcp->ofp_porthashtbl;  
        ofp_tcp_hashinit(porthash_nelements, &pcbinfo->ipi_hashmask,  
                        pcbinfo->ipi_porthashbase);  
        pcb_size = global_param->pcb_tcp_max;  
}

Take a look at the second ofp_tcp_hashinit(porthash_nelements, &pcbinfo->ipi_hashmask,

why it is &pcbinfo->ipi_hashmask, rather than &pcbinfo->ipi_porthashmask, ?

Comparing with the UDP snippets here:

else {  
        pcbinfo->ipi_hashbase = ofp_hashinit(hash_nelements, 0,  
            &pcbinfo->ipi_hashmask);  
        pcbinfo->ipi_porthashbase = ofp_hashinit(porthash_nelements, 0,  
            &pcbinfo->ipi_porthashmask);  
} 

Activity

  1. JereLeppanen commented on Nov 13, 2019

    @JereLeppanen
    Contributor

    Looks like a bug to me. This seems to leave pcbinfo->ipi_porthashmask uninitialized. Good catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions