summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjsip/src/pjsua-lib/pjsua_pres.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c
index f9e0b635..6b35070f 100644
--- a/pjsip/src/pjsua-lib/pjsua_pres.c
+++ b/pjsip/src/pjsua-lib/pjsua_pres.c
@@ -249,9 +249,13 @@ PJ_DEF(pj_status_t) pjsua_buddy_get_info( pjsua_buddy_id buddy_id,
total += info->uri.slen;
/* contact */
- info->contact.ptr = info->buf_ + total;
- pj_strncpy(&info->contact, &buddy->contact, sizeof(info->buf_)-total);
- total += info->contact.slen;
+ if (total < sizeof(info->buf_)) {
+ info->contact.ptr = info->buf_ + total;
+ pj_strncpy(&info->contact, &buddy->contact, sizeof(info->buf_) - total);
+ total += info->contact.slen;
+ } else {
+ info->contact = pj_str("");
+ }
/* Presence status */
pj_memcpy(&info->pres_status, &buddy->status, sizeof(pjsip_pres_status));