Skip to content

Commit

Permalink
Immediate children should only have one RDN separator past the parent…
Browse files Browse the repository at this point in the history
… length without NORMALIZED_ESC_BYTE+NORMALIZED_RDN_SEPARATOR
  • Loading branch information
vharseko committed Oct 29, 2024
1 parent 10ad784 commit bbfbcae
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,27 @@ static ByteStringBuilder afterLastChildOf(final ByteSequence key)
static boolean isChild(ByteSequence parent, ByteSequence child)
{
if (child.length() <= parent.length()
|| child.byteAt(parent.length()) != NORMALIZED_RDN_SEPARATOR
|| !child.startsWith(parent))
|| child.byteAt(parent.length()) != NORMALIZED_RDN_SEPARATOR
|| !child.startsWith(parent))
{
return false;
}
// Immediate children should only have one RDN separator past the parent length
boolean childSeparatorDetected = false;
for (int i = parent.length() ; i < child.length(); i++)
{
if (child.byteAt(i) == NORMALIZED_RDN_SEPARATOR)
{
return true;
if (childSeparatorDetected)
{
if (child.byteAt(i-1)==NORMALIZED_ESC_BYTE) {
continue;
}
return false;
}
childSeparatorDetected = true;
}
}
return false;
return childSeparatorDetected;
}
}

0 comments on commit bbfbcae

Please sign in to comment.