aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-10-25 18:40:34 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-10-25 18:40:34 +0000
commitf7bd2799faf6fa398a43be8715d9c0df314b6393 (patch)
tree4082b711a8db2deb58825179f8b6079d0663802f
parent443c351724ef9b9eff3327ed13940207ddf3838e (diff)
downloadfetchmail-f7bd2799faf6fa398a43be8715d9c0df314b6393.tar.gz
fetchmail-f7bd2799faf6fa398a43be8715d9c0df314b6393.tar.bz2
fetchmail-f7bd2799faf6fa398a43be8715d9c0df314b6393.zip
More economical buffer sizing.
svn path=/trunk/; revision=381
-rw-r--r--mxget.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mxget.c b/mxget.c
index 7dc2c8fd..c3cfa7b9 100644
--- a/mxget.c
+++ b/mxget.c
@@ -19,13 +19,17 @@
* This ought to be in the bind library. It's adapted from sendmail.
*/
+/* minimum possible size of MX record in packet */
+#define MIN_MX_SIZE 8 /* corresp to "a.com 0" w/ terminating space */
+
struct mxentry *getmxrecords(name)
/* get MX records for given host */
const char *name;
{
- unsigned char answer[PACKETSZ], MXHostBuf[PACKETSZ], *eom, *cp, *bp;
+ unsigned char answer[PACKETSZ], *eom, *cp, *bp;
int n, ancount, qdcount, buflen, type, pref, ind;
- static struct mxentry pmx[(PACKETSZ - HFIXEDSZ) / sizeof(struct mxentry)];
+ static struct mxentry pmx[(PACKETSZ - HFIXEDSZ) / MIN_MX_SIZE];
+ static char MXHostBuf[PACKETSZ - HFIXEDSZ];
HEADER *hp;
n = res_search(name,C_IN,T_MX,(unsigned char*)&answer, sizeof(answer));