Module: kamailio Branch: 5.4 Commit: 0752f63d41a5c02bc1a5612a22797f186e291119 URL: https://github.com/kamailio/kamailio/commit/0752f63d41a5c02bc1a5612a22797f18...
Author: Alex Hermann alex@hexla.nl Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-10-23T10:57:11+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
(cherry picked from commit fcdfaf98acf8a66e84b9dccc767fb52c0cf0d460)
---
Modified: src/core/str.h
---
Diff: https://github.com/kamailio/kamailio/commit/0752f63d41a5c02bc1a5612a22797f18... Patch: https://github.com/kamailio/kamailio/commit/0752f63d41a5c02bc1a5612a22797f18...
---
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