aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_logging.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-22 12:23:08 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-22 12:23:08 +0100
commitee5f54e2afef553dc190387e4efc668aca70f031 (patch)
tree91d93a615811a9ebdea012e6ff44999cbb53ae2c /src/util/common_logging.c
parent02132e8fc311b966154fd5d9f0b3686ea8c2bf86 (diff)
allow NULL argument for GNUNET_i2s()
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r--src/util/common_logging.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index dad5d3776d..1da4067537 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -1209,8 +1209,11 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
static char buf[256];
char *ret;
+ if (NULL == pid)
+ return "NULL";
ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key);
- strcpy (buf, ret);
+ strcpy (buf,
+ ret);
GNUNET_free (ret);
buf[4] = '\0';
return buf;
@@ -1234,8 +1237,11 @@ GNUNET_i2s2 (const struct GNUNET_PeerIdentity *pid)
static char buf[256];
char *ret;
+ if (NULL == pid)
+ return "NULL";
ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key);
- strcpy (buf, ret);
+ strcpy (buf,
+ ret);
GNUNET_free (ret);
buf[4] = '\0';
return buf;