From 8b5a4af2f9feef1ff9d6bb32fdf8a201034f6831 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 26 Mar 2022 11:36:42 +0530 Subject: [PATCH] DnsResourceRecordInfo: Added validation for Comments. --- .../Dns/ResourceRecords/DnsResourceRecordInfo.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DnsServerCore/Dns/ResourceRecords/DnsResourceRecordInfo.cs b/DnsServerCore/Dns/ResourceRecords/DnsResourceRecordInfo.cs index c70087bc..8055c1e1 100644 --- a/DnsServerCore/Dns/ResourceRecords/DnsResourceRecordInfo.cs +++ b/DnsServerCore/Dns/ResourceRecords/DnsResourceRecordInfo.cs @@ -220,7 +220,13 @@ namespace DnsServerCore.Dns.ResourceRecords public string Comments { get { return _comments; } - set { _comments = value; } + set + { + if (value.Length > 255) + throw new ArgumentOutOfRangeException(nameof(Comments), "Resource record comment text cannot exceed 255 characters."); + + _comments = value; + } } public DateTime DeletedOn