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