mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-24 00:59:19 +02:00
#25 Fixed crash on query with bad top domain
This commit is contained in:
parent
aae94200a5
commit
d5ffc25557
|
@ -14,6 +14,7 @@ CHANGES:
|
|||
- All received error messages (RCODE field) are echoed
|
||||
- Top domain limited to 128 chars
|
||||
- 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"
|
||||
- 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) {
|
||||
dns_decode(buf, buflen, q, QR_QUERY, packet, r);
|
||||
domain = strstr(q->name, topdomain);
|
||||
if (domain) {
|
||||
rv = (int) (domain - q->name);
|
||||
memcpy(buf, q->name, MIN(rv, buflen));
|
||||
q->fromlen = addrlen;
|
||||
memcpy((struct sockaddr*)&q->from, (struct sockaddr*)&from, addrlen);
|
||||
} else {
|
||||
rv = 0;
|
||||
}
|
||||
} else if (r < 0) {
|
||||
/* Error */
|
||||
perror("recvfrom");
|
||||
|
|
Loading…
Reference in New Issue