Changeset 822 for branches/ithildin-1.1


Ignore:
Timestamp:
11/07/08 03:28:26 (4 years ago)
Author:
wd
Message:

Fix various dumbnesses in the DNS code and the way the ircd module uses it.

Location:
branches/ithildin-1.1/modules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-1.1/modules/dns/dns.c

    r611 r822  
    163163        free(dns.pending.retry_times); 
    164164    dns.pending.retry_times = 
    165         malloc(sizeof(unsigned int) * (dns.pending.retries + 1)); 
     165        calloc(1, sizeof(unsigned int) * (dns.pending.retries + 1)); 
    166166    dns.pending.retry_times[dns.pending.retries] = dns.pending.timeout; 
    167167    for (i = dns.pending.retries - 1;i >= 0;i--) 
  • branches/ithildin-1.1/modules/dns/packet.c

    r736 r822  
    295295    last_rr = NULL; 
    296296    while (count) { 
    297         drp = malloc(sizeof(struct dns_rr)); 
     297        drp = calloc(1, sizeof(struct dns_rr)); 
    298298 
    299299        if ((rc = dn_expand(pkt, pkt + plen, pkt + pidx, drp->name, 
     
    323323            /* Fill in the data.  We do a copy over first, and if we need to 
    324324             * realloc and make changes below we do that too */ 
    325             drp->rdata.txt = malloc(drp->rdlen); 
     325            drp->rdata.txt = calloc(1, drp->rdlen); 
    326326            memcpy(drp->rdata.txt, rdata, drp->rdlen); 
    327327            switch (drp->type) { 
  • branches/ithildin-1.1/modules/ircd/client.c

    r777 r822  
    266266 
    267267    first[0] = *nick; 
    268     if (!istr_okay(ircd.maps.nick_first, first) || 
    269             !istr_okay(ircd.maps.nick, nick)) 
     268    if (*nick == '\0' || !istr_okay(ircd.maps.nick_first, first) || 
     269        !istr_okay(ircd.maps.nick, nick)) 
    270270        return 0; 
    271271    return 1; 
  • branches/ithildin-1.1/modules/ircd/connection.c

    r818 r822  
    274274            while (drp != NULL) { 
    275275                /* Check each answer.. */ 
    276                 if (drp->type == atype && 
    277                         !strcasecmp(drp->rdata.txt, ip)) 
     276                if (drp->type == atype &&  
     277                    drp->rdlen > 0 && drp->rdata.txt != NULL && 
     278                    !strcasecmp(drp->rdata.txt, ip)) 
    278279                    break; 
    279280                drp = LIST_NEXT(drp, lp); 
Note: See TracChangeset for help on using the changeset viewer.