]> Cypherpunks repositories - gostls13.git/commitdiff
net: check 'ok' return in dnsmsg when initially packing rr.Header()
authorTarmigan Casebolt <tarmigan@gmail.com>
Mon, 24 Aug 2015 02:51:31 +0000 (19:51 -0700)
committerMinux Ma <minux@golang.org>
Sun, 20 Sep 2015 02:55:16 +0000 (02:55 +0000)
In the present code, there is no way for ok to ever return false, but
it still a good idea to check it.

Change-Id: I8f360018b33a5d85dabbbbec0f89ffc81f77ecbb
Reviewed-on: https://go-review.googlesource.com/13956
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/net/dnsmsg.go

index 6ecaa9482304f7b1b1a9eb90814e60350a9192c9..93078fe849982bb440ed9f7cec8d700fcd431fc8 100644 (file)
@@ -691,6 +691,9 @@ func packRR(rr dnsRR, msg []byte, off int) (off2 int, ok bool) {
        // off1 is end of header
        // off2 is end of rr
        off1, ok = packStruct(rr.Header(), msg, off)
+       if !ok {
+               return len(msg), false
+       }
        off2, ok = packStruct(rr, msg, off)
        if !ok {
                return len(msg), false