This commit is contained in:
Miek Gieben 2011-03-04 17:19:19 +01:00
parent 115309962a
commit dfcd170f99
1 changed files with 3 additions and 6 deletions

9
msg.go
View File

@ -16,7 +16,7 @@ package dns
import (
"os"
"fmt"
// "fmt"
"reflect"
"net"
"rand"
@ -515,8 +515,7 @@ func unpackStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int,
off = off1 + int(optlen)
case "NSEC": // NSEC/NSEC3
if off+1 > len(msg) {
fmt.Fprintf(os.Stderr, "dns: overflow unpacking NSEC")
// TODO(MG) dit moet beter
//fmt.Fprintf(os.Stderr, "dns: overflow unpacking NSEC")
return len(msg), false
}
// Fix multple windows TODO(mg)
@ -525,7 +524,7 @@ func unpackStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int,
window := int(msg[off])
blocks := int(msg[off+1])
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
}
if blocks == 0 {
@ -537,7 +536,6 @@ func unpackStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int,
}
off += 2
fmt.Fprintf(os.Stderr, "dns: %d %d", window, blocks)
for j := 0; j < blocks; j++ {
b := msg[off+j]
// 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)
ni++
}
println("HALLO")
}
nsec = nsec[:ni]
fv.Set(reflect.NewValue(nsec).(*reflect.SliceValue))