aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-01-13 13:55:43 +0100
committerHarald Welte <laforge@gnumonks.org>2017-01-15 17:58:29 +0000
commitdf83eced6826b65db623aa77cd4a40d307d79486 (patch)
tree874d0804757340a98b17085ddd2f2785fbe56b91 /src/utils.c
parent449324b2646b3a42f621756e4556f795c1f791d1 (diff)
doc: clarify osmo_strlcpy() doc
Stating that it 'truncates src' is misleading. Also clarify whether siz includes the space needed for the terminating NUL. Change-Id: I01c1a94408b471f7f54576178a60938bf9ee3261
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utils.c b/src/utils.c
index 02c24435..df806dff 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -343,12 +343,12 @@ uint8_t *osmo_encode_big_endian(uint64_t value, size_t data_len)
/*! \brief Copy a C-string into a sized buffer
* \param[in] src source string
* \param[out] dst destination string
- * \param[in] siz size of the \a dst string
- * \returns length of source string
+ * \param[in] siz size of the \a dst buffer
+ * \returns length of \a src
*
- * Copies up to \a siz characters from \a src to \a dst, but ensures
- * that the last character of \a dst is always a NUL character. May
- * truncate \a src to do achieve this.
+ * Copy at most \a siz bytes from \a src to \a dst, ensuring that the result is
+ * NUL terminated. The NUL character is included in \a siz, i.e. passing the
+ * actual sizeof(*dst) is correct.
*/
size_t osmo_strlcpy(char *dst, const char *src, size_t siz)
{