When using res_send/res_query/res_search, the caller must either

insure enough space is available for the response, or be prepared
to resize the buffer and retry as necessary.

Do the conservative thing and make sure enough space is available.

Reviewed by:	silence on freebsd-audit
This commit is contained in:
Jacques Vidrine 2002-09-13 20:31:29 +00:00
parent 8b10ca9ba9
commit 2e4dbbaa93
6 changed files with 7 additions and 26 deletions

View File

@ -201,11 +201,7 @@ static const ns_src default_dns_files[] = {
{ 0 }
};
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
#else
#define MAXPACKET 1024
#endif
#define MAXPACKET 65536
typedef union {
HEADER hdr;

View File

@ -103,11 +103,7 @@ static void addrsort(char **, int);
static void dprintf(char *, int) __printflike(1, 0);
#endif
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
#else
#define MAXPACKET 1024
#endif
#define MAXPACKET 65536
typedef union {
HEADER hdr;

View File

@ -88,11 +88,7 @@ extern int h_errno;
#define BYNAME 1
#define MAXALIASES 35
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
#else
#define MAXPACKET 1024
#endif
#define MAXPACKET 65536
typedef union {
HEADER hdr;

View File

@ -967,11 +967,7 @@ struct __res_type_list {
int rtl_type;
};
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
#else
#define MAXPACKET 1024
#endif
#define MAXPACKET 65536
typedef union {
HEADER hdr;

View File

@ -90,11 +90,7 @@ __FBSDID("$FreeBSD$");
#include "res_config.h"
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
#else
#define MAXPACKET 1024
#endif
#define MAXPACKET 65536
/*
* Formulate a normal query, send, and await answer.

View File

@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
*/
#define NSMAX 16
#define MAXPACKET 65536
struct ns1 {
char nsname[MAXDNAME];
@ -71,7 +72,7 @@ struct zonegrp {
int
res_update(ns_updrec *rrecp_in) {
ns_updrec *rrecp, *tmprrecp;
u_char buf[PACKETSZ], answer[PACKETSZ], packet[2*PACKETSZ];
u_char buf[PACKETSZ], answer[MAXPACKET], packet[2*PACKETSZ];
char name[MAXDNAME], zname[MAXDNAME], primary[MAXDNAME],
mailaddr[MAXDNAME];
u_char soardata[2*MAXCDNAME+5*INT32SZ];