Ignore:
Timestamp:
Mar 2, 2007 2:51:03 PM (14 years ago)
Author:
bennylp
Message:

Fixed ticket #156: Not enough memory to parse DNS packets in resolver (thanks Frank Wiersma)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/pjproject-0.5-stable/pjlib-util/src/pjlib-util/resolver.c

    r974 r1033  
    5252#define RES_BUF_SZ          PJ_DNS_RESOLVER_RES_BUF_SIZE 
    5353#define UDPSZ               PJ_DNS_RESOLVER_MAX_UDP_SIZE 
     54#define TMP_SZ              PJ_DNS_RESOLVER_TMP_BUF_SIZE 
    5455 
    5556 
     
    162163    pj_bool_t            own_ioqueue;   /**< Do we own ioqueue?             */ 
    163164    pj_ioqueue_t        *ioqueue;       /**< Ioqueue instance.              */ 
    164     char                 tmp_pool[1500];/**< Temporary pool buffer.         */ 
     165    char                 tmp_pool[TMP_SZ];/**< Temporary pool buffer.       */ 
    165166 
    166167    /* Socket */ 
     
    994995    } 
    995996 
    996     /* Duplicate the packet */ 
     997    /* Duplicate the packet. 
     998     * We don't need to keep the query, NS, and AR sections from the packet, 
     999     * so exclude from duplication. 
     1000     */ 
    9971001    res_pool = pj_pool_create_on_buf("respool", cache->buf, sizeof(cache->buf)); 
    9981002    PJ_TRY { 
    9991003        cache->pkt = NULL; 
    1000         pj_dns_packet_dup(res_pool, pkt, &cache->pkt); 
     1004        pj_dns_packet_dup(res_pool, pkt,  
     1005                          PJ_DNS_NO_QD | PJ_DNS_NO_NS | PJ_DNS_NO_AR, 
     1006                          &cache->pkt); 
    10011007    } 
    10021008    PJ_CATCH_ANY { 
     
    12231229        } 
    12241230    } 
    1225  
    1226     /* We don't need NS and query section in the packet, so trim them. */ 
    1227     dns_pkt->hdr.qdcount = 0; 
    1228     dns_pkt->hdr.nscount = 0; 
    12291231 
    12301232    /* Save/update response cache. */ 
Note: See TracChangeset for help on using the changeset viewer.