
 * Packets which exactly fit a DNS query need to be marked as "last
   packet", otherwise the server won't decode them (Closes: #422462).
   Patch from Matthias Urlichs.

--- a/nstxcd.c
+++ b/nstxcd.c
@@ -143,13 +143,13 @@
     dns_setid(pkt, nsid);
     
     l = dns_getfreespace(pkt, DNS_QUERY);
-    if (l <= 0) {
+    if (l <= (int)sizeof(nh)) {
        printf("Fatal: no free space in dns-packet?!\n");
        exit(1);
     }
     p = malloc(l);
     l -= sizeof(nh);
-    if (l > datalen) {
+    if (l >= datalen) {
        l = datalen;
        nh.flags = NSTX_LF;
     }
