[sr-dev] git:master:fcdfaf98: core: Document that a str can be zero-terminated

Henning Westerholt hw at skalatan.de
Wed Oct 21 07:40:30 CEST 2020


Module: kamailio
Branch: master
Commit: fcdfaf98acf8a66e84b9dccc767fb52c0cf0d460
URL: https://github.com/kamailio/kamailio/commit/fcdfaf98acf8a66e84b9dccc767fb52c0cf0d460

Author: Alex Hermann <alex at hexla.nl>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-10-21T07:40:24+02:00

core: Document that a str can be zero-terminated

But by default it isn't.

The functions shm_str_dup() and pkg_str_dup() will always create a
zero-terminated copy

---

Modified: src/core/str.h

---

Diff:  https://github.com/kamailio/kamailio/commit/fcdfaf98acf8a66e84b9dccc767fb52c0cf0d460.diff
Patch: https://github.com/kamailio/kamailio/commit/fcdfaf98acf8a66e84b9dccc767fb52c0cf0d460.patch

---

diff --git a/src/core/str.h b/src/core/str.h
index 01b12ecb62..58d7d627f6 100644
--- a/src/core/str.h
+++ b/src/core/str.h
@@ -40,13 +40,16 @@
  * need to make a zero-terminated copy of it.
  *
  * @section drawbacks Drawbacks
- * Note well that the fact that string stored
- * using this data structure are not zero terminated makes them a little
- * incovenient to use with many standard libc string functions, because these
- * usually expect the input to be zero-terminated. In this case you have to
- * either make a zero-terminated copy or inject the terminating zero behind
- * the actuall string (if possible). Note that injecting a zero terminating
- * characters is considered to be dangerous.
+ * Note well that the fact that a string stored
+ * using this data structure are not guaranteed to be zero terminated (by
+ * default they're not) makes them a little incovenient to use with many
+ * standard libc string functions, because these usually expect the input
+ * to be zero-terminated.
+ * In this case you have to either make a zero-terminated copy or inject the
+ * terminating zero behind the actuall string (if possible). Note that
+ * injecting a zero terminating characters is considered to be dangerous.
+ * The functions shm_str_dup() and pkg_str_dup() will always create a
+ * zero-terminated copy.
  */
 
 /** @file




More information about the sr-dev mailing list