assert in udns_resolver.c:788

Michael Tokarev mjt at corpit.ru
Thu May 26 09:55:35 MSD 2005


serge rasnikov wrote:
> Hello.
> 
> sorry for stupid question :-), but..
> 
> udns_resolver.c:788: dns_end_query: Assertion `(status < 0 &&
> result == 0) || (status >= 0 && result != 0)' failed.
> 
> is bug in my programm or not?

No it is not a bug in your code, it's a bug in udns, a known
one.  The following patch:

--- udns_resolver.c     5 May 2005 19:16:43 -0000       1.51
+++ udns_resolver.c     8 May 2005 12:54:31 -0000       1.52
@@ -1142,8 +1142,11 @@ again:
       break;
     }
     /* the only case where we may succeed */
-    if (q->dnsq_parse)
+    if (q->dnsq_parse) {
       r = q->dnsq_parse(dns_payload(q->dnsq_buf), pbuf, pcur, pend, &result);
+      if (r < 0)
+        result = NULL;
+    }
     else if ((result = malloc(r)) != NULL)
       memcpy(result, pbuf, r);
     else

will fix the issue, which only happens when one query in a row of
several returns NODATA result.

Which reminds me I should upload the fixed version.

/mjt


More information about the udns mailing list