UnpackDomainName: fix infinite loop where it would lower 'off'
When a pointer points to a empty name, the "return '.'" special case used to
kick in which is not pointer-aware so it would reset the parsing offset to
the pointer target
This was independently found and fixed in c13d4ee
, I'm submitting this patch
anyway as it seems a bit more robust and DRY [citation needed].
This commit is contained in:
parent
77aa064ef9
commit
2b564cd047
9
msg.go
9
msg.go
|
@ -413,12 +413,6 @@ Loop:
|
|||
case 0x00:
|
||||
if c == 0x00 {
|
||||
// end of name
|
||||
if len(s) == 0 {
|
||||
if ptr == 0 {
|
||||
off1 = off
|
||||
}
|
||||
return ".", off1, nil
|
||||
}
|
||||
break Loop
|
||||
}
|
||||
// literal string
|
||||
|
@ -479,6 +473,9 @@ Loop:
|
|||
if ptr == 0 {
|
||||
off1 = off
|
||||
}
|
||||
if len(s) == 0 {
|
||||
s = []byte(".")
|
||||
}
|
||||
return string(s), off1, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue