Skip to content

Commit

Permalink
rtpengine: Fix possible startup crash in notification process
Browse files Browse the repository at this point in the history
When the "notification_sock" modparam was set, the process responsible
for notifications would start by scanning a non-NULL terminated string
past the end boundary, sometimes leading to a crash on startup.

Fixes #2947

(cherry picked from commit cb59a84)
  • Loading branch information
liviuchircu committed Nov 25, 2022
1 parent c597857 commit bd493f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/rtpengine/rtpengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -3506,7 +3506,7 @@ static void rtpengine_notify_process(int rank)
union sockaddr_union ss;
char buffer[RTPENGINE_DGRAM_BUF];

p = strrchr(rtpengine_notify_sock.s, ':');
p = q_memchr(rtpengine_notify_sock.s, ':', rtpengine_notify_sock.len);
if (!p) {
LM_ERR("no port specified in notification socket %.*s!\n",
rtpengine_notify_sock.len, rtpengine_notify_sock.s);
Expand Down
2 changes: 1 addition & 1 deletion modules/rtpengine/rtpengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

struct rtpe_node {
unsigned int idx; /* overall index */
str rn_url; /* unparsed, deletable */
str rn_url; /* unparsed, deletable, NULL-term */
int rn_umode;
char *rn_address; /* substring of rn_url */
int rn_disabled; /* found unaccessible? */
Expand Down

0 comments on commit bd493f6

Please sign in to comment.