Misc (ticket #838):
- protect pj_strdup() for case when source and destination string are the same pointer. Without this, destination string will contain garbage value.
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2749 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/include/pj/string_i.h b/pjlib/include/pj/string_i.h
index 1dcce8d..f7e72eb 100644
--- a/pjlib/include/pj/string_i.h
+++ b/pjlib/include/pj/string_i.h
@@ -32,6 +32,10 @@
pj_str_t *dst,
const pj_str_t *src)
{
+ /* Without this, destination will be corrupted */
+ if (dst == src)
+ return dst;
+
if (src->slen) {
dst->ptr = (char*)pj_pool_alloc(pool, src->slen);
pj_memcpy(dst->ptr, src->ptr, src->slen);