From cdf60abf74bfdfbeda27ee3c81f1d4cb50a987c1 Mon Sep 17 00:00:00 2001
From: Uros Majstorovic <majstor@majstor.org>
Date: Fri, 19 Jan 2018 16:59:33 +0100
Subject: fixed node init

---
 code/ecp/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'code')

diff --git a/code/ecp/core.c b/code/ecp/core.c
index 2631f13..f8d3ec7 100644
--- a/code/ecp/core.c
+++ b/code/ecp/core.c
@@ -16,7 +16,8 @@ int ecp_node_init(ECPContext *ctx, ECPNode *node, ecp_dh_public_t *public, void
     int rv = ECP_OK;
     
     memset(node, 0, sizeof(ECPNode));
-    memcpy(&node->public, public, sizeof(node->public));
+
+    if (public) memcpy(&node->public, public, sizeof(node->public));
 
     if (addr && ctx->tr.addr_set) rv = ctx->tr.addr_set(&node->addr, addr);
     if (rv) return ECP_ERR_NET_ADDR;
-- 
cgit v1.2.3