]> Pileus Git - ~andy/fetchmail/commitdiff
More economical buffer sizing.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 25 Oct 1996 18:40:34 +0000 (18:40 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 25 Oct 1996 18:40:34 +0000 (18:40 -0000)
svn path=/trunk/; revision=381

mxget.c

diff --git a/mxget.c b/mxget.c
index 7dc2c8fdb938bec1222be6a841d72022f2177d02..c3cfa7b96c98fccc1ecaea213245e95bccd85b18 100644 (file)
--- a/mxget.c
+++ b/mxget.c
  * 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));