mirror of
https://github.com/miekg/dns.git
synced 2025-10-11 09:51:01 +02:00
Fixes
This commit is contained in:
parent
115309962a
commit
dfcd170f99
9
msg.go
9
msg.go
@ -16,7 +16,7 @@ package dns
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"fmt"
|
// "fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"net"
|
"net"
|
||||||
"rand"
|
"rand"
|
||||||
@ -515,8 +515,7 @@ func unpackStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int,
|
|||||||
off = off1 + int(optlen)
|
off = off1 + int(optlen)
|
||||||
case "NSEC": // NSEC/NSEC3
|
case "NSEC": // NSEC/NSEC3
|
||||||
if off+1 > len(msg) {
|
if off+1 > len(msg) {
|
||||||
fmt.Fprintf(os.Stderr, "dns: overflow unpacking NSEC")
|
//fmt.Fprintf(os.Stderr, "dns: overflow unpacking NSEC")
|
||||||
// TODO(MG) dit moet beter
|
|
||||||
return len(msg), false
|
return len(msg), false
|
||||||
}
|
}
|
||||||
// Fix multple windows TODO(mg)
|
// Fix multple windows TODO(mg)
|
||||||
@ -525,7 +524,7 @@ func unpackStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int,
|
|||||||
window := int(msg[off])
|
window := int(msg[off])
|
||||||
blocks := int(msg[off+1])
|
blocks := int(msg[off+1])
|
||||||
if off+blocks > len(msg) {
|
if off+blocks > len(msg) {
|
||||||
fmt.Fprintf(os.Stderr, "dns: overflow unpacking NSEC")
|
//fmt.Fprintf(os.Stderr, "dns: overflow unpacking NSEC")
|
||||||
return len(msg), false
|
return len(msg), false
|
||||||
}
|
}
|
||||||
if blocks == 0 {
|
if blocks == 0 {
|
||||||
@ -537,7 +536,6 @@ func unpackStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int,
|
|||||||
}
|
}
|
||||||
|
|
||||||
off += 2
|
off += 2
|
||||||
fmt.Fprintf(os.Stderr, "dns: %d %d", window, blocks)
|
|
||||||
for j := 0; j < blocks; j++ {
|
for j := 0; j < blocks; j++ {
|
||||||
b := msg[off+j]
|
b := msg[off+j]
|
||||||
// Check the bits one by one, and set the type
|
// Check the bits one by one, and set the type
|
||||||
@ -573,7 +571,6 @@ func unpackStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int,
|
|||||||
nsec[ni] = uint16(window*256 + j*8 + 7)
|
nsec[ni] = uint16(window*256 + j*8 + 7)
|
||||||
ni++
|
ni++
|
||||||
}
|
}
|
||||||
println("HALLO")
|
|
||||||
}
|
}
|
||||||
nsec = nsec[:ni]
|
nsec = nsec[:ni]
|
||||||
fv.Set(reflect.NewValue(nsec).(*reflect.SliceValue))
|
fv.Set(reflect.NewValue(nsec).(*reflect.SliceValue))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user