summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-10-25 04:16:45 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-10-25 04:19:11 +0200
commitbcf9f23456b58e4c959d84bb42d325589c3669ee (patch)
tree5bf91470353c9fa3ce3faa8daf010d34f4415b2f
parentb48e82ca9eee93ccd821cd179951837bf7a22d6a (diff)
utils: avoid segfault when calling osmo_strlcpy(src=NULL)
Change-Id: Ieba7ba262ace2e370a4b9a550b3131fb13f07413
-rw-r--r--src/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index ef8e916e..f5894d89 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -372,7 +372,7 @@ uint8_t *osmo_encode_big_endian(uint64_t value, size_t data_len)
*/
size_t osmo_strlcpy(char *dst, const char *src, size_t siz)
{
- size_t ret = strlen(src);
+ size_t ret = src ? strlen(src) : 0;
if (siz) {
size_t len = (ret >= siz) ? siz - 1 : ret;