[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet-nim] branch master updated: fix crash on empty mess

From: gnunet
Subject: [GNUnet-SVN] [gnunet-nim] branch master updated: fix crash on empty messages
Date: Mon, 24 Jun 2019 21:28:07 +0200

This is an automated email from the git hooks/post-receive script.

lurchi pushed a commit to branch master
in repository gnunet-nim.

The following commit(s) were added to refs/heads/master by this push:
     new 2e02681  fix crash on empty messages
2e02681 is described below

commit 2e02681fc8c274af6737fb8b139b3d834e3d1019
Author: lurchi <address@hidden>
AuthorDate: Mon Jun 24 21:27:08 2019 +0200

    fix crash on empty messages
 src/gnunet_nim/cadet.nim | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gnunet_nim/cadet.nim b/src/gnunet_nim/cadet.nim
index b9fe0b7..576abb1 100644
--- a/src/gnunet_nim/cadet.nim
+++ b/src/gnunet_nim/cadet.nim
@@ -44,12 +44,14 @@ proc channelConnectCb(cls: pointer,
 proc channelMessageCb(cls: pointer,
                       messageHeader: ptr GNUNET_MessageHeader) {.cdecl.} =
+  echo "channelMessageCb"
   let channel = cast[ptr CadetChannel](cls)
   let payloadLen = int(ntohs(messageHeader.size)) - 
   let payload = cast[ptr 
GNUNET_MessageHeader](cast[ByteAddress](messageHeader) + 
   var payloadBuf = newString(payloadLen)
-  copyMem(addr payloadBuf[0], payload, payloadLen)
+  if payloadLen > 0:
+    copyMem(addr payloadBuf[0], payload, payloadLen)
   waitFor channel.messages.write(payloadBuf)
 proc channelMessageCheckCb(cls: pointer,

To stop receiving notification emails like this one, please contact

reply via email to

[Prev in Thread] Current Thread [Next in Thread]