aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_logging.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-20 00:35:13 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-20 00:36:20 +0200
commit0be37e812d034754eb725701f237fbc81b973904 (patch)
treec50481209ec97b5dbbd075489255477c5e761d3d /src/util/common_logging.c
parentc227e3f00efb4b3677e9b85c0273a7bf5fbcb4a9 (diff)
downloadgnunet-0be37e812d034754eb725701f237fbc81b973904.tar.gz
gnunet-0be37e812d034754eb725701f237fbc81b973904.zip
fix off-by-one error in cadet connection construction, also enforce better timeouts for retransmissions of handshake
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r--src/util/common_logging.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index df501fbcd..ce9bd6e46 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -1344,14 +1344,15 @@ GNUNET_h2s_full (const struct GNUNET_HashCode * hc)
1344const char * 1344const char *
1345GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) 1345GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
1346{ 1346{
1347 static char buf[256]; 1347 static char buf[5];
1348 char *ret; 1348 char *ret;
1349 1349
1350 if (NULL == pid) 1350 if (NULL == pid)
1351 return "NULL"; 1351 return "NULL";
1352 ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key); 1352 ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key);
1353 strcpy (buf, 1353 strncpy (buf,
1354 ret); 1354 ret,
1355 sizeof (buf) - 1);
1355 GNUNET_free (ret); 1356 GNUNET_free (ret);
1356 buf[4] = '\0'; 1357 buf[4] = '\0';
1357 return buf; 1358 return buf;
@@ -1372,14 +1373,15 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
1372const char * 1373const char *
1373GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid) 1374GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid)
1374{ 1375{
1375 static char buf[256]; 1376 static char buf[5];
1376 char *ret; 1377 char *ret;
1377 1378
1378 if (NULL == pid) 1379 if (NULL == pid)
1379 return "NULL"; 1380 return "NULL";
1380 ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key); 1381 ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key);
1381 strcpy (buf, 1382 strncpy (buf,
1382 ret); 1383 ret,
1384 sizeof (buf) - 1);
1383 GNUNET_free (ret); 1385 GNUNET_free (ret);
1384 buf[4] = '\0'; 1386 buf[4] = '\0';
1385 return buf; 1387 return buf;