lib: Fix CID 1272913 Calling risky function
authorVolker Lendecke <vl@samba.org>
Tue, 23 Jun 2015 08:02:17 +0000 (10:02 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 23 Jun 2015 20:12:08 +0000 (22:12 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/addns/dnsrecord.c

index 724d0dfd8fae75563da91d80ebd1532fb37b0277..0d14937399719f790eb6ccb8c41a3df7994dba35 100644 (file)
@@ -22,6 +22,7 @@
 */
 
 #include "dns.h"
 */
 
 #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,
 
 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;
        }
 
                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];
 
        req->num_questions = 1;
        q = req->questions[0];