From fc1e8e4d47fe8242e361bfb44ef6048dddee886f Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 27 Apr 2012 13:44:49 +0000 Subject: [PATCH] working string toaddress --- src/transport/plugin_transport_unix.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 9027c2773..a195fb7f8 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c @@ -1034,14 +1034,14 @@ unix_string_to_address (void *cls, const char *addr, uint16_t addrlen, return GNUNET_SYSERR; } - if ((strlen (addr) + 1) != addrlen) - { - GNUNET_break (0); - return GNUNET_SYSERR; - } + char * tmp = GNUNET_malloc (addrlen + 1); + memcpy (tmp, addr, addrlen); + tmp[addrlen] = '\0'; + + //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "`%s'\n", tmp); - (*buf) = GNUNET_strdup (addr); - (*added) = strlen (addr) + 1; + (*buf) = tmp; + (*added) = strlen (tmp); return GNUNET_OK; } -- 2.25.1