diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-05-02 15:55:59 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-05-02 15:55:59 +0000 |
commit | 82964eb088dd45b26fe2f7eaaae8722c2ae0f9cd (patch) | |
tree | 7f7432e8e11eef1dc13ec6df1168c102ff35d355 | |
parent | d6447a68c24855cb6b98126fc3745338658361de (diff) |
- Increment MAX_ADDRS in evdns so as to be quite large.
- Accept as well-formed DNS replies with questions but no answers.
- Fix for crash in evdns_resolve_reverse_ipv6().
- Move end of "extern C {" block to the end of evdns.h.
From the libevent SVN repo.
ok millert@
-rw-r--r-- | lib/libevent/evdns.c | 9 | ||||
-rw-r--r-- | lib/libevent/evdns.h | 10 |
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/libevent/evdns.c b/lib/libevent/evdns.c index 56d2d4f6a0b..f39703f3cd9 100644 --- a/lib/libevent/evdns.c +++ b/lib/libevent/evdns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evdns.c,v 1.3 2008/05/02 06:09:11 brad Exp $ */ +/* $OpenBSD: evdns.c,v 1.4 2008/05/02 15:55:58 brad Exp $ */ /* The original version of this module was written by Adam Langley; for * a history of modifications, check out the subversion logs. @@ -139,7 +139,7 @@ typedef unsigned int uint; #define u16 uint16_t #define u8 uint8_t -#define MAX_ADDRS 4 /* maximum number of addresses from a single packet */ +#define MAX_ADDRS 32 /* maximum number of addresses from a single packet */ /* which we bother recording */ #define TYPE_A EVDNS_TYPE_A @@ -850,7 +850,7 @@ reply_parse(u8 *packet, int length) { */ SKIP_NAME; j += 4; - if (j >= length) goto err; + if (j > length) goto err; } /* now we have the answer section which looks like @@ -2270,7 +2270,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) { - char buf[64]; + /* 32 nybbles, 32 periods, "ip6.arpa", NUL. */ + char buf[73]; char *cp; struct request *req; int i; diff --git a/lib/libevent/evdns.h b/lib/libevent/evdns.h index aa7b4f924a9..83f09dddd02 100644 --- a/lib/libevent/evdns.h +++ b/lib/libevent/evdns.h @@ -1,4 +1,4 @@ -/* $OpenBSD: evdns.h,v 1.2 2008/05/02 06:09:11 brad Exp $ */ +/* $OpenBSD: evdns.h,v 1.3 2008/05/02 15:55:58 brad Exp $ */ /* * Copyright (c) 2006 Niels Provos <provos@citi.umich.edu> @@ -315,10 +315,6 @@ void evdns_set_log_fn(evdns_debug_log_fn_type fn); #define DNS_NO_SEARCH 1 -#ifdef __cplusplus -} -#endif - /* * Structures and functions used to implement a DNS server. */ @@ -366,4 +362,8 @@ int evdns_server_request_drop(struct evdns_server_request *req); struct sockaddr; int evdns_server_request_get_requesting_addr(struct evdns_server_request *_req, struct sockaddr *sa, int addr_len); +#ifdef __cplusplus +} +#endif + #endif /* !EVENTDNS_H */ |