Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions TechnitiumLibrary.Net/IPAddressExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Technitium Library
Copyright (C) 2025 Shreyas Zare (shreyas@technitium.com)
Copyright (C) 2026 Zafer Balkan (zafer@zaferbalkan.com)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -444,6 +445,14 @@ public static bool TryParseReverseDomain(string ptrDomain, out IPAddress address
//192.168.10.1

string[] parts = ptrDomain.Split('.');

// Expecting 6 parts: 4 octets + in-addr + arpa
if (parts.Length != 6)
{
address = null;
return false;
}

Span<byte> buffer = stackalloc byte[4];

for (int i = 0, j = parts.Length - 3; (i < 4) && (j > -1); i++, j--)
Expand Down