Skip to content

Commit

Permalink
[MME] Fix potential null ptr dereference
Browse files Browse the repository at this point in the history
The assert is checking for sess->session->name, but afterwards there's a
check to skip ses->session not being null, which means the assert can
crash while dereferencing sess->session.
  • Loading branch information
pespin committed Jan 5, 2024
1 parent b1515a1 commit 973b2bc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/mme/mme-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -4082,10 +4082,11 @@ mme_sess_t *mme_sess_find_by_apn(mme_ue_t *mme_ue, char *apn)

sess = mme_sess_first(mme_ue);
while (sess) {
ogs_assert(sess->session->name);
if (sess->session && ogs_strcasecmp(sess->session->name, apn) == 0)
return sess;

if (sess->session) {
ogs_assert(sess->session->name);
if (ogs_strcasecmp(sess->session->name, apn) == 0)
return sess;
}
sess = mme_sess_next(sess);
}

Expand Down

0 comments on commit 973b2bc

Please sign in to comment.