#25 Fixed crash on query with bad top domain
This commit is contained in:
parent
285a412563
commit
f932e57ce6
|
@ -14,6 +14,7 @@ CHANGES:
|
||||||
- All received error messages (RCODE field) are echoed
|
- All received error messages (RCODE field) are echoed
|
||||||
- Top domain limited to 128 chars
|
- Top domain limited to 128 chars
|
||||||
- Case preservation check sent after login to decide codec
|
- Case preservation check sent after login to decide codec
|
||||||
|
- Fixed crash on incoming NULL query in server with bad top domain
|
||||||
|
|
||||||
2007-03-25: 0.4.0 "Run Home"
|
2007-03-25: 0.4.0 "Run Home"
|
||||||
- Added multiuser support (up to 8 users simultaneously)
|
- Added multiuser support (up to 8 users simultaneously)
|
||||||
|
|
|
@ -379,10 +379,14 @@ read_dns(int fd, struct query *q, char *buf, int buflen)
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
dns_decode(buf, buflen, q, QR_QUERY, packet, r);
|
dns_decode(buf, buflen, q, QR_QUERY, packet, r);
|
||||||
domain = strstr(q->name, topdomain);
|
domain = strstr(q->name, topdomain);
|
||||||
|
if (domain) {
|
||||||
rv = (int) (domain - q->name);
|
rv = (int) (domain - q->name);
|
||||||
memcpy(buf, q->name, MIN(rv, buflen));
|
memcpy(buf, q->name, MIN(rv, buflen));
|
||||||
q->fromlen = addrlen;
|
q->fromlen = addrlen;
|
||||||
memcpy((struct sockaddr*)&q->from, (struct sockaddr*)&from, addrlen);
|
memcpy((struct sockaddr*)&q->from, (struct sockaddr*)&from, addrlen);
|
||||||
|
} else {
|
||||||
|
rv = 0;
|
||||||
|
}
|
||||||
} else if (r < 0) {
|
} else if (r < 0) {
|
||||||
/* Error */
|
/* Error */
|
||||||
perror("recvfrom");
|
perror("recvfrom");
|
||||||
|
|
Loading…
Reference in New Issue