diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-20 00:35:13 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-20 00:36:20 +0200 |
commit | 0be37e812d034754eb725701f237fbc81b973904 (patch) | |
tree | c50481209ec97b5dbbd075489255477c5e761d3d /src/util | |
parent | c227e3f00efb4b3677e9b85c0273a7bf5fbcb4a9 (diff) | |
download | gnunet-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')
-rw-r--r-- | src/util/common_logging.c | 14 | ||||
-rw-r--r-- | src/util/mq.c | 26 |
2 files changed, 34 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) | |||
1344 | const char * | 1344 | const char * |
1345 | GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) | 1345 | GNUNET_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) | |||
1372 | const char * | 1373 | const char * |
1373 | GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid) | 1374 | GNUNET_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; |
diff --git a/src/util/mq.c b/src/util/mq.c index dbcce704d..81a42e0c6 100644 --- a/src/util/mq.c +++ b/src/util/mq.c | |||
@@ -1071,6 +1071,32 @@ GNUNET_MQ_set_options (struct GNUNET_MQ_Handle *mq, | |||
1071 | 1071 | ||
1072 | 1072 | ||
1073 | /** | 1073 | /** |
1074 | * Obtain message contained in envelope. | ||
1075 | * | ||
1076 | * @param env the envelope | ||
1077 | * @return message contained in the envelope | ||
1078 | */ | ||
1079 | const struct GNUNET_MessageHeader * | ||
1080 | GNUNET_MQ_env_get_msg (const struct GNUNET_MQ_Envelope *env) | ||
1081 | { | ||
1082 | return env->mh; | ||
1083 | } | ||
1084 | |||
1085 | |||
1086 | /** | ||
1087 | * Return next envelope in queue. | ||
1088 | * | ||
1089 | * @param env a queued envelope | ||
1090 | * @return next one, or NULL | ||
1091 | */ | ||
1092 | const struct GNUNET_MQ_Envelope * | ||
1093 | GNUNET_MQ_env_next (const struct GNUNET_MQ_Envelope *env) | ||
1094 | { | ||
1095 | return env->next; | ||
1096 | } | ||
1097 | |||
1098 | |||
1099 | /** | ||
1074 | * Register function to be called whenever @a mq is being | 1100 | * Register function to be called whenever @a mq is being |
1075 | * destroyed. | 1101 | * destroyed. |
1076 | * | 1102 | * |