lib: Fix CID 1272913 Calling risky function
[nivanova/samba-autobuild/.git] / lib / addns / dnsrecord.c
index 724d0dfd8fae75563da91d80ebd1532fb37b0277..0d14937399719f790eb6ccb8c41a3df7994dba35 100644 (file)
@@ -22,6 +22,7 @@
 */
 
 #include "dns.h"
+#include "lib/util/genrand.h"
 
 DNS_ERROR dns_create_query( TALLOC_CTX *mem_ctx, const char *name,
                            uint16_t q_type, uint16_t q_class,
@@ -39,7 +40,7 @@ DNS_ERROR dns_create_query( TALLOC_CTX *mem_ctx, const char *name,
                return ERROR_DNS_NO_MEMORY;
        }
 
-       req->id = random();
+       generate_random_buffer((uint8_t *)&req->id, sizeof(req->id));
 
        req->num_questions = 1;
        q = req->questions[0];