dirmngr: Fix possible null reference.
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 12 Apr 2017 06:58:11 +0000 (15:58 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 12 Apr 2017 06:58:11 +0000 (15:58 +0900)
* dirmngr/dns.c (dns_error_t dns_trace_fput): Check NULL.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
dirmngr/dns.c

index 39d3295..9bba329 100644 (file)
@@ -4606,8 +4606,9 @@ dns_error_t dns_trace_fput(const struct dns_trace_event *te, const void *data, s
 
        if (fwrite(&tmp, 1, headsize, fp) < headsize)
                return errno;
-       if (fwrite(data, 1, datasize, fp) < datasize)
-               return errno;
+       if (data)
+               if (fwrite(data, 1, datasize, fp) < datasize)
+                       return errno;
        if (fflush(fp))
                return errno;