summaryrefslogtreecommitdiff
path: root/pjlib/include/pj/string_i.h
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib/include/pj/string_i.h')
-rw-r--r--pjlib/include/pj/string_i.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/pjlib/include/pj/string_i.h b/pjlib/include/pj/string_i.h
index b26d5ead..fd864f3f 100644
--- a/pjlib/include/pj/string_i.h
+++ b/pjlib/include/pj/string_i.h
@@ -120,7 +120,8 @@ PJ_IDEF(pj_str_t*) pj_strncpy( pj_str_t *dst, const pj_str_t *src,
{
pj_assert(max >= 0);
if (max > src->slen) max = src->slen;
- pj_memcpy(dst->ptr, src->ptr, max);
+ if (max > 0)
+ pj_memcpy(dst->ptr, src->ptr, max);
dst->slen = max;
return dst;
}