Changeset 557


Ignore:
Timestamp:
Jun 28, 2006 11:10:02 AM (18 years ago)
Author:
bennylp
Message:

Fixed bug in sockaddr_in: the sin_zero part of the sockaddr_in is not zeroed, causing SIP transport hash table to behave erraticly

Location:
pjproject/trunk/pjlib/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/sock_bsd.c

    r433 r557  
    211211    RESET_LEN(addr); 
    212212    addr->sin_family = AF_INET; 
     213    pj_memset(addr->sin_zero, 0, sizeof(addr->sin_zero)); 
    213214 
    214215    if (str_addr && str_addr->slen) { 
     
    248249    RESET_LEN(addr); 
    249250    addr->sin_family = PJ_AF_INET; 
     251    pj_memset(addr->sin_zero, 0, sizeof(addr->sin_zero)); 
    250252    pj_sockaddr_in_set_port(addr, port); 
    251253    return pj_sockaddr_in_set_str_addr(addr, str_addr); 
     
    369371    SET_LEN(&addr, sizeof(pj_sockaddr_in)); 
    370372    addr.sin_family = PJ_AF_INET; 
     373    pj_memset(addr.sin_zero, 0, sizeof(addr.sin_zero)); 
    371374    addr.sin_addr.s_addr = pj_htonl(addr32); 
    372375    addr.sin_port = pj_htons(port); 
  • pjproject/trunk/pjlib/src/pjlib-test/sock.c

    r509 r557  
    7979    unsigned char *p; 
    8080    pj_in_addr addr; 
     81    char zero[64]; 
     82    pj_sockaddr_in addr2; 
    8183    const pj_str_t *hostname; 
    8284 
     
    104106        return -30; 
    105107 
     108    /* Test that pj_sockaddr_in_init() initialize the whole structure,  
     109     * including sin_zero. 
     110     */ 
     111    pj_sockaddr_in_init(&addr2, 0, 1000); 
     112    pj_memset(zero, 0, sizeof(zero)); 
     113    if (pj_memcmp(addr2.sin_zero, zero, sizeof(addr2.sin_zero)) != 0) 
     114        return -35; 
     115 
    106116    /* pj_gethostname() */ 
    107117    hostname = pj_gethostname(); 
     
    113123 
    114124    /* pj_gethostaddr() */ 
     125 
    115126 
    116127    return 0; 
Note: See TracChangeset for help on using the changeset viewer.