From ee5f54e2afef553dc190387e4efc668aca70f031 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 22 Jan 2017 12:23:08 +0100 Subject: [PATCH] allow NULL argument for GNUNET_i2s() --- src/util/common_logging.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/util/common_logging.c b/src/util/common_logging.c index dad5d3776..1da406753 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; -- 2.25.1