Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jdomnitz committed Apr 20, 2023
1 parent 0695ea5 commit c794da9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/WireWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ public void WriteDomainName(DomainName name, bool uncompressed = false)
for (var i = 0; i < n; ++i)
{
var label = labels[i];
if (label.Length > 63)
var labelBytes = Encoding.UTF8.GetBytes(label);
if (labelBytes.Length > 63)
throw new ArgumentException($"Label '{label}' cannot exceed 63 octets.");

// Check for qualified name already used.
Expand All @@ -286,8 +287,7 @@ public void WriteDomainName(DomainName name, bool uncompressed = false)
}

// Add the label
var bytes = Encoding.UTF8.GetBytes(label);
WriteByteLengthPrefixedBytes(bytes);
WriteByteLengthPrefixedBytes(labelBytes);
}

stream.WriteByte(0); // terminating byte
Expand Down

0 comments on commit c794da9

Please sign in to comment.