X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftransmit.c;h=47785e6b57bab73c7a773a12b54630d54d789bc2;hb=0f15dd7b03058cb07e55d36ab36029081d556ffc;hp=c669af6f797cff804aab68ca693a28a31d637806;hpb=2953d358511ac5d196362f6b339c010d4e9cae3e;p=adns.git diff --git a/src/transmit.c b/src/transmit.c index c669af6..47785e6 100644 --- a/src/transmit.c +++ b/src/transmit.c @@ -5,11 +5,11 @@ */ /* * This file is - * Copyright (C) 1997-1999 Ian Jackson + * Copyright (C) 1997-2000 Ian Jackson * * It is part of adns, which is - * Copyright (C) 1997-1999 Ian Jackson - * Copyright (C) 1999 Tony Finch + * Copyright (C) 1997-2000 Ian Jackson + * Copyright (C) 1999-2000 Tony Finch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +77,7 @@ static adns_status mkquery_footer(vbuf *vb, adns_rrtype type) { adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r, const char *owner, int ol, const typeinfo *typei, adns_queryflags flags) { - int ll, c, nlabs; + int ll, c, nbytes; byte label[255], *rqp; const char *p, *pe; adns_status st; @@ -87,7 +87,7 @@ adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r, MKQUERY_START(vb); p= owner; pe= owner+ol; - nlabs= 0; + nbytes= 0; while (p!=pe) { ll= 0; while (p!=pe && (c= *p++)!='.') { @@ -115,7 +115,9 @@ adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r, label[ll++]= c; } if (!ll) return adns_s_querydomaininvalid; - if (nlabs++ > 63) return adns_s_querydomaintoolong; + if (ll > DNS_MAXLABEL) return adns_s_querydomaintoolong; + nbytes+= ll+1; + if (nbytes >= DNS_MAXDOMAIN) return adns_s_querydomaintoolong; MKQUERY_ADDB(ll); memcpy(rqp,label,ll); rqp+= ll; } @@ -246,7 +248,7 @@ void adns__query_send(adns_query qu, struct timeval now) { r= sendto(ads->udpsocket,qu->query_dgram,qu->query_dglen,0, (const struct sockaddr*)&servaddr,sizeof(servaddr)); if (r<0 && errno == EMSGSIZE) { qu->retries= 0; query_usetcp(qu,now); return; } - if (r<0) adns__warn(ads,serv,0,"sendto failed: %s",strerror(errno)); + if (r<0 && errno != EAGAIN) adns__warn(ads,serv,0,"sendto failed: %s",strerror(errno)); qu->timeout= now; timevaladd(&qu->timeout,UDPRETRYMS);