mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
r15024@catbus: nickm | 2007-09-10 10:49:15 -0400
Fix evdns_resolve_reverse_ipv6() so buffer is bug enough, and so the string ends with ".ip6.arpa" rather than "..ip6.arpa". svn:r427
This commit is contained in:
parent
c396c767e2
commit
8b39254926
@ -8,3 +8,4 @@ Changes in current version:
|
|||||||
o Make adding of array members in event_rpcgen more efficient, but doubling memory allocation
|
o Make adding of array members in event_rpcgen more efficient, but doubling memory allocation
|
||||||
o Fix a memory leak in the DNS server
|
o Fix a memory leak in the DNS server
|
||||||
o Fix compilation when DNS_USE_OPENSSL_FOR_ID is enabled
|
o Fix compilation when DNS_USE_OPENSSL_FOR_ID is enabled
|
||||||
|
o Fix buffer size and string generation in evdns_resolve_reverse_ipv6().
|
||||||
|
7
evdns.c
7
evdns.c
@ -2265,7 +2265,8 @@ int evdns_resolve_reverse(struct in_addr *in, int flags, evdns_callback_type cal
|
|||||||
}
|
}
|
||||||
|
|
||||||
int evdns_resolve_reverse_ipv6(struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr) {
|
int evdns_resolve_reverse_ipv6(struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr) {
|
||||||
char buf[64];
|
/* 32 nybbles, 32 periods, "ip6.arpa", NUL. */
|
||||||
|
char buf[73];
|
||||||
char *cp;
|
char *cp;
|
||||||
struct request *req;
|
struct request *req;
|
||||||
int i;
|
int i;
|
||||||
@ -2278,8 +2279,8 @@ int evdns_resolve_reverse_ipv6(struct in6_addr *in, int flags, evdns_callback_ty
|
|||||||
*cp++ = "0123456789abcdef"[byte >> 4];
|
*cp++ = "0123456789abcdef"[byte >> 4];
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
}
|
}
|
||||||
assert(cp + strlen(".ip6.arpa") < buf+sizeof(buf));
|
assert(cp + strlen("ip6.arpa") < buf+sizeof(buf));
|
||||||
memcpy(cp, ".ip6.arpa", strlen(".ip6.arpa")+1);
|
memcpy(cp, "ip6.arpa", strlen("ip6.arpa")+1);
|
||||||
log(EVDNS_LOG_DEBUG, "Resolve requested for %s (reverse)", buf);
|
log(EVDNS_LOG_DEBUG, "Resolve requested for %s (reverse)", buf);
|
||||||
req = request_new(TYPE_PTR, buf, flags, callback, ptr);
|
req = request_new(TYPE_PTR, buf, flags, callback, ptr);
|
||||||
if (!req) return 1;
|
if (!req) return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user