Skip to content

Commit

Permalink
cc: make sure no NULL is deref
Browse files Browse the repository at this point in the history
Fixes coverity CID 40918, 40919, 40659 and 40660
  • Loading branch information
razvancrainea committed Oct 24, 2016
1 parent f2bcdb3 commit 752e69f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions modules/call_center/cc_data.c
Expand Up @@ -689,13 +689,13 @@ struct cc_call* new_cc_call(struct cc_data *data, struct cc_flow *flow, str *dn,
p = (char*)(call+1);

/*copy DisplayName and UserName */
if (dn) {
if (dn && dn->s) {
call->caller_dn.s = p;
call->caller_dn.len = dn->len;
memcpy( p, dn->s, dn->len );
p += dn->len;
}
if (un) {
if (un && un->s) {
call->caller_un.s = p;
call->caller_un.len = un->len;
memcpy( p, un->s, un->len );
Expand Down
6 changes: 2 additions & 4 deletions modules/call_center/cc_db.c
Expand Up @@ -372,13 +372,11 @@ int cc_db_restore_calls( struct cc_data *data)
/* CALLER_DN_COL */
check_val( ROW_VALUES(row)+7, DB_STRING, 1, 0, "caller_dn");
dn.s = (char*)VAL_STRING(ROW_VALUES(row)+7);
if(dn.s)
dn.len = strlen(dn.s);
dn.len = (dn.s ? strlen(dn.s) : 0);
/* CALLER_UN_COL */
check_val( ROW_VALUES(row)+8, DB_STRING, 1, 0, "caller_un");
un.s = (char*)VAL_STRING(ROW_VALUES(row)+8);
if(un.s)
un.len = strlen(un.s);
un.len = (un.s ? strlen(un.s) : 0);

call = new_cc_call(data, flow, &dn, &un);
if (call==NULL) {
Expand Down

0 comments on commit 752e69f

Please sign in to comment.