Overflow fixes

This commit is contained in:
Miek Gieben 2012-01-21 12:35:19 +01:00
parent 283d984261
commit f25584e94e
2 changed files with 5 additions and 1 deletions

View File

@ -515,7 +515,7 @@ func rawSignatureData(rrset RRset, s *RR_RRSIG) (buf []byte) {
// 6.2. Canonical RR Form. (5) - origTTL
ttl := h.Ttl
wire := make([]byte, r.Len())
wire := make([]byte, r.Len()*2)
h.Ttl = s.OrigTtl
off, ok1 := packRR(r, wire, 0, nil, false)
if !ok1 {

4
msg.go
View File

@ -438,6 +438,10 @@ func packStructValue(val reflect.Value, msg []byte, off int, compression map[str
}
length = (t - window*256) / 8
bit := t - (window * 256) - (length * 8)
if off+2+int(length) > lenmsg {
println("dns: overflow packing NSECx bitmap")
return lenmsg, false
}
// Setting the window #
msg[off] = byte(window)