summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2017-12-29 13:09:15 +0100
committerJeremy Allison <jra@samba.org>2018-01-04 00:37:21 +0100
commit15748c325c35c5e63ccff8cfcc4f3f555ebda77a (patch)
tree9b4a9b340cbb792a9b73467603169aa97343b9ff /librpc
parent300821b7934084f06b44b7a63a63db7cb544e8fa (diff)
downloadsamba-15748c325c35c5e63ccff8cfcc4f3f555ebda77a.tar.gz
ndr_dns: fix pushing unknown resource records
When pulling for example an RRSIG record, we end up with length!=0 *and* unexpected.length != 0, but with an unknown rrec. We should be able to marshall what we retrieved from the wire. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/ndr/ndr_dns.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/librpc/ndr/ndr_dns.c b/librpc/ndr/ndr_dns.c
index 4e4c556e20d..d37c8cc2ece 100644
--- a/librpc/ndr/ndr_dns.c
+++ b/librpc/ndr/ndr_dns.c
@@ -289,11 +289,20 @@ _PUBLIC_ enum ndr_err_code ndr_push_dns_res_rec(struct ndr_push *ndr,
_saved_offset1 = ndr->offset;
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 0));
if (r->length > 0) {
+ uint32_t _saved_offset3;
+
NDR_CHECK(ndr_push_set_switch_value(ndr, &r->rdata,
r->rr_type));
+ _saved_offset3 = ndr->offset;
NDR_CHECK(ndr_push_dns_rdata(ndr, NDR_SCALARS,
&r->rdata));
- if (r->unexpected.length > 0) {
+ if ((ndr->offset != _saved_offset3) &&
+ (r->unexpected.length > 0)) {
+ /*
+ * ndr_push_dns_rdata pushed a known
+ * record, but we have something
+ * unexpected. That's invalid.
+ */
return ndr_push_error(ndr,
NDR_ERR_LENGTH,
"Invalid...Unexpected " \