diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-05-02 13:25:32 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-05-02 13:25:32 +0000 |
commit | 002641dca1067843c94349c3bd7cf4ee0afcae37 (patch) | |
tree | 391d3467d355224abdc1d5dbde57fabac3a2feae /src/transport/plugin_transport_unix.c | |
parent | 4ba7a736fee18101f5a3d232353a206b3a298b66 (diff) | |
download | gnunet-002641dca1067843c94349c3bd7cf4ee0afcae37.tar.gz gnunet-002641dca1067843c94349c3bd7cf4ee0afcae37.zip |
- fix
Diffstat (limited to 'src/transport/plugin_transport_unix.c')
-rw-r--r-- | src/transport/plugin_transport_unix.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 9c29aeb14..78025ab75 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -1041,7 +1041,7 @@ unix_plugin_address_pretty_printer (void *cls, const char *type, | |||
1041 | * | 1041 | * |
1042 | * @param cls closure ('struct Plugin*') | 1042 | * @param cls closure ('struct Plugin*') |
1043 | * @param addr string address | 1043 | * @param addr string address |
1044 | * @param addrlen length of the address | 1044 | * @param addrlen length of the address (strlen(addr) + '\0') |
1045 | * @param buf location to store the buffer | 1045 | * @param buf location to store the buffer |
1046 | * If the function returns GNUNET_SYSERR, its contents are undefined. | 1046 | * If the function returns GNUNET_SYSERR, its contents are undefined. |
1047 | * @param added length of created address | 1047 | * @param added length of created address |
@@ -1057,14 +1057,20 @@ unix_string_to_address (void *cls, const char *addr, uint16_t addrlen, | |||
1057 | return GNUNET_SYSERR; | 1057 | return GNUNET_SYSERR; |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | char * tmp = GNUNET_malloc (addrlen + 1); | 1060 | if ('\0' != addr[addrlen - 1]) |
1061 | memcpy (tmp, addr, addrlen); | 1061 | { |
1062 | tmp[addrlen] = '\0'; | 1062 | GNUNET_break (0); |
1063 | return GNUNET_SYSERR; | ||
1064 | } | ||
1063 | 1065 | ||
1064 | //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "`%s'\n", tmp); | 1066 | if (strlen (addr) != addrlen - 1) |
1067 | { | ||
1068 | GNUNET_break (0); | ||
1069 | return GNUNET_SYSERR; | ||
1070 | } | ||
1065 | 1071 | ||
1066 | (*buf) = tmp; | 1072 | (*buf) = strdup (addr); |
1067 | (*added) = strlen (tmp) + 1; | 1073 | (*added) = strlen (addr) + 1; |
1068 | return GNUNET_OK; | 1074 | return GNUNET_OK; |
1069 | } | 1075 | } |
1070 | 1076 | ||