summaryrefslogtreecommitdiff
path: root/source4/dns_server
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-05-24 14:57:11 +0200
committerKai Blin <kai@samba.org>2012-05-30 00:37:52 +0200
commit1bbdf224bbed0ba85556ad31062c854a2775add7 (patch)
tree577e6e6d2f5d3dedde93245450c072999ab68f1a /source4/dns_server
parent40e47d08af8d287d1e8b66ffb96e3ed051516403 (diff)
downloadsamba-1bbdf224bbed0ba85556ad31062c854a2775add7.tar.gz
samba-1bbdf224bbed0ba85556ad31062c854a2775add7.tar.bz2
samba-1bbdf224bbed0ba85556ad31062c854a2775add7.zip
s4-dns: Add some NULL checks to create_response_rr
Signed-off-by: Kai Blin <kai@samba.org>
Diffstat (limited to 'source4/dns_server')
-rw-r--r--source4/dns_server/dns_query.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c
index b3984a4639..212c5e42ab 100644
--- a/source4/dns_server/dns_query.c
+++ b/source4/dns_server/dns_query.c
@@ -47,9 +47,15 @@ static WERROR create_response_rr(const struct dns_name_question *question,
switch (rec->wType) {
case DNS_QTYPE_CNAME:
ans[ai].rdata.cname_record = talloc_strdup(ans, rec->data.cname);
+ if (ans[ai].rdata.cname_record == NULL) {
+ return WERR_NOMEM;
+ }
break;
case DNS_QTYPE_A:
ans[ai].rdata.ipv4_record = talloc_strdup(ans, rec->data.ipv4);
+ if (ans[ai].rdata.ipv4_record == NULL) {
+ return WERR_NOMEM;
+ }
break;
case DNS_QTYPE_AAAA:
ans[ai].rdata.ipv6_record = rec->data.ipv6;
@@ -77,9 +83,15 @@ static WERROR create_response_rr(const struct dns_name_question *question,
break;
case DNS_QTYPE_TXT:
tmp = talloc_asprintf(ans, "\"%s\"", rec->data.txt.str[0]);
+ if (tmp == NULL) {
+ return WERR_NOMEM;
+ }
for (i=1; i<rec->data.txt.count; i++) {
tmp = talloc_asprintf_append(tmp, " \"%s\"",
rec->data.txt.str[i]);
+ if (tmp == NULL) {
+ return WERR_NOMEM;
+ }
}
ans[ai].rdata.txt_record.txt = tmp;
break;
@@ -89,6 +101,9 @@ static WERROR create_response_rr(const struct dns_name_question *question,
}
ans[ai].name = talloc_strdup(ans, question->name);
+ if (ans[ai].name == NULL) {
+ return WERR_NOMEM;
+ }
ans[ai].rr_type = rec->wType;
ans[ai].rr_class = DNS_QCLASS_IN;
ans[ai].ttl = rec->dwTtlSeconds;