Skip to content

Commit

Permalink
Fix reserved label cause inifity loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ba0f3 committed Sep 22, 2022
1 parent 478c268 commit 6647ca8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dnsclient.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.3.0"
version = "0.3.1"
author = "Huy Doan"
description = "Simple DNS Client & Library"
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions src/dnsclientpkg/utils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ proc getName*(data: StringStream): string =
kind = LabelType(length and TYPE_MASK)
case kind
of TYPE_INDIR:
# lenght is first octet << 8 + last octet
# length is first octet << 8 + last octet
offset = (length.uint16 shl 8 + data.readUint8()) xor 0xC000'u16
lastPos = data.getPosition()
data.setPosition(offset.int)
Expand All @@ -63,7 +63,7 @@ proc getName*(data: StringStream): string =
break # last label was INDIR, stop the loop
else:
#reversed
discard
break
result = if labels.len == 1: labels[0] else: labels.join(".")

proc ipv4ToString*(ip: int32): string =
Expand Down

0 comments on commit 6647ca8

Please sign in to comment.