From 4daf6b361203f17f2bba43f9c52eeccc698a0c52 Mon Sep 17 00:00:00 2001
From: Pablo Greco <pablo@fliagreco.com.ar>
Date: Wed, 12 Dec 2018 16:53:10 +0000
Subject: [PATCH] Check buffer size before adding comment
---
lib/dns/masterdump.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c
index 80fcd4c..8e3f9e3 100644
--- a/lib/dns/masterdump.c
+++ b/lib/dns/masterdump.c
@@ -451,7 +451,13 @@ rdataset_totext(dns_rdataset_t *rdataset,
* Comment?
*/
if ((ctx->style.flags & DNS_STYLEFLAG_COMMENTDATA) != 0)
+ {
+ isc_region_t r;
+ isc_buffer_availableregion(target, &r);
+ if (r.length < 1)
+ return (ISC_R_NOSPACE);
isc_buffer_putstr(target, ";");
+ }
/*
* Owner name.
--
1.8.3.1