]> Cypherpunks.ru repositories - nncp.git/commitdiff
Fixed invalid "Size" type, leading to panic during Progress
authorSergey Matveev <stargrave@stargrave.org>
Thu, 8 Apr 2021 12:50:53 +0000 (15:50 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 14 Apr 2021 18:01:49 +0000 (21:01 +0300)
doc/news.ru.texi
doc/news.texi
ports/nncp/Makefile
src/nncp.go
src/sp.go

index 6ca08c7e871262f92b78a6395e877016e4abccec..ea1c700ff4acaf21a2e0ee9cdc851d999c896d4e 100644 (file)
@@ -1,6 +1,16 @@
 @node Новости
 @section Новости
 
+@node Релиз 6.3.0
+@subsection Релиз 6.3.0
+@itemize
+
+@item
+Исправлено возможное падение программы во время показа прогресса online
+протокола.
+
+@end itemize
+
 @node Релиз 6.2.1
 @subsection Релиз 6.2.1
 @itemize
index e128886c5934289f8b9e0c96cdef3b7e3a75f418..87be65235774f1bbfe1be404a27ae220f6b5d9a0 100644 (file)
@@ -3,6 +3,15 @@
 
 See also this page @ref{Новости, on russian}.
 
+@node Release 6.3.0
+@section Release 6.3.0
+@itemize
+
+@item
+Fixed possible panic while showing progress during online protocol.
+
+@end itemize
+
 @node Release 6.2.1
 @section Release 6.2.1
 @itemize
index cc666d8e41df6392cb44da5d0bc59bad48df95a1..e2a7e5d9f4ec3f882bf160b9666638c174cad78a 100644 (file)
@@ -1,7 +1,7 @@
 # $FreeBSD: $
 
 PORTNAME=      nncp
-DISTVERSION=   6.1.0
+DISTVERSION=   6.3.0
 CATEGORIES=    net
 MASTER_SITES=  http://www.nncpgo.org/download/
 
index 1a933a03e03edc8daed95d88f8f63508e02bc7a4..12edaa40f73c52cf37e2b745a42f99455eedb7a9 100644 (file)
@@ -40,7 +40,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.`
 const Base32Encoded32Len = 52
 
 var (
-       Version string = "6.2.1"
+       Version string = "6.3.0"
 
        Base32Codec *base32.Encoding = base32.StdEncoding.WithPadding(base32.NoPadding)
 )
index f2c707f1029bd15bd8585bcb974b3da017097cf7..e6e4900a47052ceb81098d3e8d0f453889c48e7a 100644 (file)
--- a/src/sp.go
+++ b/src/sp.go
@@ -729,7 +729,7 @@ func (state *SPState) StartWorkers(
                        for _, payload := range infosPayloads[1:] {
                                state.Ctx.LogD(
                                        "sp-queue-remaining",
-                                       append(les, LE{"Size", len(payload)}),
+                                       append(les, LE{"Size", int64(len(payload))}),
                                        func(les LEs) string {
                                                return fmt.Sprintf(
                                                        "SP with %s (nice %s): queuing remaining payload (%s)",
@@ -752,7 +752,7 @@ func (state *SPState) StartWorkers(
                        humanize.IBytes(uint64(len(payload))),
                )
        }
-       state.Ctx.LogD("sp-process", append(les, LE{"Size", len(payload)}), logMsg)
+       state.Ctx.LogD("sp-process", append(les, LE{"Size", int64(len(payload))}), logMsg)
        replies, err := state.ProcessSP(payload)
        if err != nil {
                state.Ctx.LogE("sp-process", les, err, logMsg)
@@ -763,7 +763,7 @@ func (state *SPState) StartWorkers(
                for _, reply := range replies {
                        state.Ctx.LogD(
                                "sp-queue-reply",
-                               append(les, LE{"Size", len(reply)}),
+                               append(les, LE{"Size", int64(len(reply))}),
                                func(les LEs) string {
                                        return fmt.Sprintf(
                                                "SP with %s (nice %s): queuing reply (%s)",
@@ -828,7 +828,7 @@ func (state *SPState) StartWorkers(
                                        ) {
                                                state.Ctx.LogD(
                                                        "sp-queue-info",
-                                                       append(les, LE{"Size", len(payload)}),
+                                                       append(les, LE{"Size", int64(len(payload))}),
                                                        func(les LEs) string {
                                                                return fmt.Sprintf(
                                                                        "SP with %s (nice %s): queuing new info (%s)",
@@ -869,7 +869,7 @@ func (state *SPState) StartWorkers(
                        case payload = <-state.payloads:
                                state.Ctx.LogD(
                                        "sp-got-payload",
-                                       append(les, LE{"Size", len(payload)}),
+                                       append(les, LE{"Size", int64(len(payload))}),
                                        func(les LEs) string {
                                                return fmt.Sprintf(
                                                        "SP with %s (nice %s): got payload (%s)",
@@ -955,16 +955,18 @@ func (state *SPState) StartWorkers(
                                                return
                                        }
                                        buf = buf[:n]
-                                       state.Ctx.LogD(
-                                               "sp-file-read",
-                                               append(lesp, LE{"Size", n}),
-                                               func(les LEs) string {
-                                                       return fmt.Sprintf(
-                                                               "%s: read %s",
-                                                               logMsg(les), humanize.IBytes(uint64(n)),
-                                                       )
-                                               },
+                                       lesp = append(
+                                               les,
+                                               LE{"XX", string(TTx)},
+                                               LE{"Pkt", pktName},
+                                               LE{"Size", int64(n)},
                                        )
+                                       state.Ctx.LogD("sp-file-read", lesp, func(les LEs) string {
+                                               return fmt.Sprintf(
+                                                       "%s: read %s",
+                                                       logMsg(les), humanize.IBytes(uint64(n)),
+                                               )
+                                       })
                                }
                                state.closeFd(pth)
                                payload = MarshalSP(SPTypeFile, SPFile{
@@ -973,7 +975,13 @@ func (state *SPState) StartWorkers(
                                        Payload: buf,
                                })
                                ourSize := freq.Offset + uint64(len(buf))
-                               lesp = append(lesp, LE{"Size", int64(ourSize)}, LE{"FullSize", fullSize})
+                               lesp = append(
+                                       les,
+                                       LE{"XX", string(TTx)},
+                                       LE{"Pkt", pktName},
+                                       LE{"Size", int64(ourSize)},
+                                       LE{"FullSize", fullSize},
+                               )
                                if state.Ctx.ShowPrgrs {
                                        Progress("Tx", lesp)
                                }
@@ -1005,7 +1013,7 @@ func (state *SPState) StartWorkers(
                                        humanize.IBytes(uint64(len(payload))),
                                )
                        }
-                       state.Ctx.LogD("sp-sending", append(les, LE{"Size", len(payload)}), logMsg)
+                       state.Ctx.LogD("sp-sending", append(les, LE{"Size", int64(len(payload))}), logMsg)
                        conn.SetWriteDeadline(time.Now().Add(DefaultDeadline)) // #nosec G104
                        if err := state.WriteSP(conn, state.csOur.Encrypt(nil, nil, payload), ping); err != nil {
                                state.Ctx.LogE("sp-sending", les, err, logMsg)
@@ -1053,7 +1061,7 @@ func (state *SPState) StartWorkers(
                        }
                        state.Ctx.LogD(
                                "sp-recv-got",
-                               append(les, LE{"Size", len(payload)}),
+                               append(les, LE{"Size", int64(len(payload))}),
                                func(les LEs) string { return logMsg(les) + ": got" },
                        )
                        payload, err = state.csTheir.Decrypt(nil, nil, payload)
@@ -1065,7 +1073,7 @@ func (state *SPState) StartWorkers(
                        }
                        state.Ctx.LogD(
                                "sp-recv-process",
-                               append(les, LE{"Size", len(payload)}),
+                               append(les, LE{"Size", int64(len(payload))}),
                                func(les LEs) string {
                                        return logMsg(les) + ": processing"
                                },
@@ -1082,7 +1090,7 @@ func (state *SPState) StartWorkers(
                                for _, reply := range replies {
                                        state.Ctx.LogD(
                                                "sp-recv-reply",
-                                               append(les[:len(les)-1], LE{"Size", len(reply)}),
+                                               append(les[:len(les)-1], LE{"Size", int64(len(reply))}),
                                                func(les LEs) string {
                                                        return fmt.Sprintf(
                                                                "SP with %s (nice %s): queuing reply (%s)",
@@ -1326,7 +1334,7 @@ func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
                                lesp,
                                LE{"XX", string(TRx)},
                                LE{"Pkt", pktName},
-                               LE{"Size", len(file.Payload)},
+                               LE{"Size", int64(len(file.Payload))},
                        )
                        logMsg := func(les LEs) string {
                                return fmt.Sprintf(