... | ... |
@@ -177,7 +177,10 @@ struct rdata* get_record(char* name, int type) |
177 | 177 |
head=rd=0; |
178 | 178 |
crt=&head; |
179 | 179 |
size=res_search(name, C_IN, type, buff.buff, sizeof(buff)); |
180 |
- if (size<0) goto error; |
|
180 |
+ if (size<0) { |
|
181 |
+ LOG(L_ERR, "ERROR: get_record: size<0\n"); |
|
182 |
+ goto error; |
|
183 |
+ } |
|
181 | 184 |
else if (size > sizeof(buff)) size=sizeof(buff); |
182 | 185 |
|
183 | 186 |
p=buff.buff+DNS_HDR_SIZE; |
... | ... |
@@ -187,20 +190,29 @@ struct rdata* get_record(char* name, int type) |
187 | 190 |
|
188 | 191 |
for (r=0; r<qno; r++){ |
189 | 192 |
/* skip the name of the question */ |
190 |
- if ((p=dns_skipname(p, end))==0) goto error; |
|
193 |
+ if ((p=dns_skipname(p, end))==0) { |
|
194 |
+ LOG(L_ERR, "ERROR: get_record: skipname==0\n"); |
|
195 |
+ goto error; |
|
196 |
+ } |
|
191 | 197 |
p+=2+2; /* skip QCODE & QCLASS */ |
192 | 198 |
#if 0 |
193 | 199 |
for (;(p<end && (*p)); p++); |
194 | 200 |
p+=1+2+2; /* skip the ending '\0, QCODE and QCLASS */ |
195 | 201 |
#endif |
196 |
- if (p>end) goto error; |
|
202 |
+ if (p>end) { |
|
203 |
+ LOG(L_ERR, "ERROR: get_record: p>end\n"); |
|
204 |
+ goto error; |
|
205 |
+ } |
|
197 | 206 |
}; |
198 | 207 |
answers_no=ntohs((unsigned short)buff.hdr.ancount); |
199 | 208 |
ans_len=ANS_SIZE; |
200 | 209 |
t=answer; |
201 | 210 |
for (r=0; (r<answers_no) && (p<end); r++){ |
202 | 211 |
/* ignore it the default domain name */ |
203 |
- if ((p=dns_skipname(p, end))==0) goto error; |
|
212 |
+ if ((p=dns_skipname(p, end))==0) { |
|
213 |
+ LOG(L_ERR, "ERROR: get_record: skip_name=0 (#2)\n"); |
|
214 |
+ goto error; |
|
215 |
+ } |
|
204 | 216 |
/* |
205 | 217 |
skip=dn_expand(buff.buff, end, p, t, ans_len); |
206 | 218 |
p+=skip; |