Skip to content

Commit

Permalink
dialog: increase puid size for profile to ensure null termination
Browse files Browse the repository at this point in the history
(cherry picked from commit f2796ce)
  • Loading branch information
miconda committed Aug 30, 2017
1 parent bff436f commit c07e616
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/modules/dialog/dlg_profile.c
Expand Up @@ -661,7 +661,7 @@ int dlg_add_profile(dlg_cell_t *dlg, str *value, struct dlg_profile_table *profi
}
if(puid && puid->s && puid->len>0) {
if(puid->len<SRUID_SIZE) {
strcpy(linker->hash_linker.puid, puid->s);
memcpy(linker->hash_linker.puid, puid->s, puid->len);
linker->hash_linker.puid_len = puid->len;
} else {
LM_ERR("puid size is too large\n");
Expand All @@ -671,7 +671,8 @@ int dlg_add_profile(dlg_cell_t *dlg, str *value, struct dlg_profile_table *profi
} else {
sruid_next_safe(&_dlg_profile_sruid);
if(_dlg_profile_sruid.uid.len<SRUID_SIZE) {
strcpy(linker->hash_linker.puid, _dlg_profile_sruid.uid.s);
memcpy(linker->hash_linker.puid, _dlg_profile_sruid.uid.s,
_dlg_profile_sruid.uid.len);
linker->hash_linker.puid_len = _dlg_profile_sruid.uid.len;
} else {
LM_ERR("sruid size is too large\n");
Expand Down
2 changes: 1 addition & 1 deletion src/modules/dialog/dlg_profile.h
Expand Up @@ -54,7 +54,7 @@
typedef struct dlg_profile_hash {
str value; /*!< hash value */
struct dlg_cell *dlg; /*!< dialog cell */
char puid[SRUID_SIZE];
char puid[SRUID_SIZE+2];
int puid_len;
time_t expires;
int flags;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/dialog/dlg_req_within.c
Expand Up @@ -406,7 +406,7 @@ static inline int send_bye(struct dlg_cell * cell, int dir, str *hdrs)
dlg_lreq_callee_headers.len);
lhdrs.len += dlg_lreq_callee_headers.len;
if(dlg_lreq_callee_headers.s[dlg_lreq_callee_headers.len-1]!='\n') {
strncpy(lhdrs.s+lhdrs.len, CRLF, CRLF_LEN);
memcpy(lhdrs.s+lhdrs.len, CRLF, CRLF_LEN);
lhdrs.len += CRLF_LEN;
}
}
Expand Down

0 comments on commit c07e616

Please sign in to comment.