From: Matthias Wachs Date: Fri, 27 Apr 2012 13:44:49 +0000 (+0000) Subject: working string toaddress X-Git-Tag: initial-import-from-subversion-38251~13736 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fc1e8e4d47fe8242e361bfb44ef6048dddee886f;p=oweals%2Fgnunet.git working string toaddress --- 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; }