packStructValue: fix a overflow in NSEC packing

This commit is contained in:
Filippo Valsorda 2015-08-05 00:18:02 +01:00
parent b5133fead4
commit 0df69faa6e

2
msg.go
View File

@ -785,7 +785,7 @@ func packStructValue(val reflect.Value, msg []byte, off int, compression map[str
} }
length = (t - window*256) / 8 length = (t - window*256) / 8
bit := t - (window * 256) - (length * 8) bit := t - (window * 256) - (length * 8)
if off+2+int(length) > lenmsg { if off+2+int(length)+1 > lenmsg {
return lenmsg, &Error{err: "overflow packing nsecx bitmap"} return lenmsg, &Error{err: "overflow packing nsecx bitmap"}
} }