Skip to content

Commit

Permalink
cplc: null terminate log string
Browse files Browse the repository at this point in the history
- reset field to avoid double free
  • Loading branch information
miconda committed Dec 8, 2017
1 parent abc9c4f commit 66051f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/cplc/cpl_log.c
Expand Up @@ -84,7 +84,7 @@ void compile_logs( str *log)
log->len += cpl_logs[i].len;

/* get a buffer */
log->s = (char*)pkg_malloc(log->len);
log->s = (char*)pkg_malloc(log->len+1);
if (log->s==0) {
LM_ERR("no more pkg mem\n");
log->len = 0;
Expand All @@ -97,6 +97,7 @@ void compile_logs( str *log)
memcpy( p, cpl_logs[i].s, cpl_logs[i].len);
p += cpl_logs[i].len;
}
log->s[log->len] = '\0';

return;
}
Expand Down
1 change: 1 addition & 0 deletions src/modules/cplc/cpl_time.c
Expand Up @@ -328,6 +328,7 @@ int tr_byxxx_init(tr_byxxx_p _bxp, int _nr)
if(!_bxp->req)
{
pkg_free(_bxp->xxx);
_bxp->xxx = NULL;
return -1;
}

Expand Down

0 comments on commit 66051f4

Please sign in to comment.