diff -ur deadwood-2.3.07/src/DwMararc.c deadwood-2.3.08/src/DwMararc.c
--- deadwood-2.3.07/src/DwMararc.c	2009-10-21 13:45:24.000000000 -0500
+++ deadwood-2.3.08/src/DwMararc.c	2012-03-22 12:39:31.000000000 -0600
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2009 Sam Trenholme
+/* Copyright (c) 2007-2012 Sam Trenholme
  *
  * TERMS
  *
@@ -28,7 +28,7 @@
 /* Number of dictionary parameters in the mararc file */
 #define KEY_D_COUNT 1
 /* Number of numeric parameters in the mararc file */
-#define KEY_N_COUNT 16
+#define KEY_N_COUNT 17
 
 dwm_fs fsm[DWM_MAX_STATES + 1]; /* Finite state machine */
 dw_str *key_s[KEY_S_COUNT + 1]; /* All of the string dwood2rc parameters */
@@ -73,6 +73,7 @@
                         * server before giving up */
 	"verbose_level", /* How verbose our logging should be */
 	"deliver_all", /* Deliver non-cachable replies */
+	"max_ttl", /* Maximum allowed TTL */
         0 };
 
 char *fsm_desc=dwm_machine;
@@ -427,6 +428,7 @@
 	key_n[DWM_N_num_retries] = 1;
 	key_n[DWM_N_verbose_level] = 3;
 	key_n[DWM_N_deliver_all] = 1;
+	key_n[DWM_N_max_ttl] = 86400;
 }
 
 /* Look for a Mararc parameter; -1 if not found/error; 0-n if found
diff -ur deadwood-2.3.07/src/DwMararc.h deadwood-2.3.08/src/DwMararc.h
--- deadwood-2.3.07/src/DwMararc.h	2009-10-21 13:44:39.000000000 -0500
+++ deadwood-2.3.08/src/DwMararc.h	2012-03-22 12:39:31.000000000 -0600
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2009 Sam Trenholme
+/* Copyright (c) 2007-2012 Sam Trenholme
  *
  * TERMS
  *
@@ -46,6 +46,7 @@
 #define DWM_N_num_retries 13
 #define DWM_N_verbose_level 14
 #define DWM_N_deliver_all 15
+#define DWM_N_max_ttl 16
 
 /* Various character classes used by the Mararc parser's finite state
  * machine */
diff -ur deadwood-2.3.07/src/DwSocket.c deadwood-2.3.08/src/DwSocket.c
--- deadwood-2.3.07/src/DwSocket.c	2009-10-21 13:44:39.000000000 -0500
+++ deadwood-2.3.08/src/DwSocket.c	2012-03-22 12:39:31.000000000 -0600
@@ -1,4 +1,5 @@
-/* Copyright (c) 2007-2008 Sam Trenholme and Jean-Jacques Sarton
+/* Copyright (c) 2007-2012 Sam Trenholme 
+ * IPv6 code contributed by Jean-Jacques Sarton
  *
  * TERMS
  *
@@ -57,6 +58,7 @@
 int32_t num_ports = 4096;
 int32_t maradns_uid = 99;
 int32_t maradns_gid = 99;
+int32_t max_ttl = 86400;
 int num_retries = 1;
 int deliver_all = 0;
 
@@ -361,6 +363,10 @@
         resurrections = get_key_n(DWM_N_resurrections,0,1,1);
         num_retries = get_key_n(DWM_N_num_retries,0,8,1);
 	deliver_all = get_key_n(DWM_N_deliver_all,0,1,1);	
+	max_ttl = get_key_n(DWM_N_max_ttl,
+		300 /* 5 minutes */,
+		7776000 /* 90 days */,
+		86400 /* One day */);
 
         if((num_ports & (num_ports - 1)) != 0) {
                 dw_fatal("num_ports must be a power of 2");
diff -ur deadwood-2.3.07/src/DwStr.c deadwood-2.3.08/src/DwStr.c
--- deadwood-2.3.07/src/DwStr.c	2010-07-31 14:43:51.000000000 -0500
+++ deadwood-2.3.08/src/DwStr.c	2012-03-22 12:44:28.000000000 -0600
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2009 Sam Trenholme
+/* Copyright (c) 2007-2012 Sam Trenholme
  *
  * TERMS
  *
@@ -786,6 +786,9 @@
 		return max;
 	}
 
+	if(max < 1) {
+		max = 1;
+	}
 	if(max > 31536000) {
 		max = 31536000;
 	}
@@ -802,9 +805,9 @@
 	type = ((int32_t)*(raw + 0) << 8) | ((int32_t)*(raw + 1));
 
         if(*(raw + 4) > 0x7f) {
-                return 31536000; /* TTL out of bounds */
+                return max; /* TTL out of bounds */
         }
-        out = ((int32_t)*(raw + 4)<< 24) |
+        out = ((int32_t)*(raw + 4) << 24) |
               ((int32_t)*(raw + 5) << 16) |
               ((int32_t)*(raw + 6) << 8) |
               ((int32_t)*(raw + 7));
diff -ur deadwood-2.3.07/src/DwUdpSocket.c deadwood-2.3.08/src/DwUdpSocket.c
--- deadwood-2.3.07/src/DwUdpSocket.c	2009-10-21 13:46:08.000000000 -0500
+++ deadwood-2.3.08/src/DwUdpSocket.c	2012-03-22 12:39:31.000000000 -0600
@@ -1,4 +1,5 @@
-/* Copyright (c) 2007-2009 Sam Trenholme and Jean-Jacques Sarton
+/* Copyright (c) 2007-2012 Sam Trenholme 
+ * IPv6 code contributed by Jean-Jacques Sarton
  *
  * TERMS
  *
@@ -50,6 +51,7 @@
 extern int num_ports;
 extern int num_retries;
 extern int deliver_all;
+extern int32_t max_ttl;
 
 #ifdef MINGW
 /* Needed for the Windows way of making a socket non-blocking */
@@ -527,7 +529,7 @@
                 goto catch_cache_dns_reply;
         }
 
-        ttl = dw_get_a_dnsttl(answer,0,31536000,ancount);
+        ttl = dw_get_a_dnsttl(answer,0,max_ttl,ancount);
 
         if(ttl == -1) {
                 goto catch_cache_dns_reply;
