aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-09-21 17:09:31 +0200
committerlaforge <laforge@osmocom.org>2020-09-22 19:28:14 +0000
commitc29d513a2b76bf689eb9a5d5914bd0f28065aa5d (patch)
treee000fb5c0f0ec4ac8a9d74cbe873a3780b2e6e87
parent4692a1c3bf001d326b36c7182d3b380a2a7fdb93 (diff)
osmo_strlcpy: Avoid calling memcpy with size=0
-rw-r--r--src/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utils.c b/src/utils.c
index 3c4a8c9f..168f85fe 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -545,7 +545,7 @@ uint64_t osmo_decode_big_endian(const uint8_t *data, size_t data_len)
/*! Generic big-endian encoding of big endian number up to 64bit
* \param[in] value unsigned integer value to be stored
- * \param[in] data_len number of octets
+ * \param[in] data_len number of octets
* \returns static buffer containing big-endian stored value
*
* This is like osmo_store64be_ext, except that this returns a static buffer of
@@ -577,7 +577,7 @@ size_t osmo_strlcpy(char *dst, const char *src, size_t siz)
if (siz) {
size_t len = (ret >= siz) ? siz - 1 : ret;
- if (src)
+ if (len)
memcpy(dst, src, len);
dst[len] = '\0';
}