Skip to content

Commit

Permalink
b2b_entities: alocate mem for empty str
Browse files Browse the repository at this point in the history
Otherwise the `reason` variable points to a volatile memory that
dissapears, leading to an uninitialized variable
  • Loading branch information
razvancrainea committed Sep 9, 2024
1 parent 1ea63fc commit 550eb6b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/b2b_entities/ua_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ int raise_ua_sess_event(str *key, enum b2b_entity_type ent_type,
str method;
str *reason;
int statuscode;
str empty = STR_NULL;

if (evi_param_set_str(evi_key_param, key) < 0) {
LM_ERR("cannot set event parameter\n");
Expand All @@ -190,7 +191,7 @@ int raise_ua_sess_event(str *key, enum b2b_entity_type ent_type,
if (msg->first_line.type == SIP_REQUEST) {
method = msg->first_line.u.request.method;
statuscode = 0;
reason = &STR_NULL;
reason = &empty;
} else {
method = get_cseq(msg)->method;
statuscode = msg->first_line.u.reply.statuscode;
Expand Down

0 comments on commit 550eb6b

Please sign in to comment.