diff options
author | Mark Michelson <mmichelson@digium.com> | 2010-07-14 22:32:29 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2010-07-14 22:32:29 +0000 |
commit | 1e8c66e749a20c2c0202f0da58918e9313f0512c (patch) | |
tree | f8f902d38011e82daa5eb6696813e6e08940de0d /res/res_rtp_asterisk.c | |
parent | 5d9aa45721c6f953b4798b5feb15c52397626dee (diff) |
Fix errors where incorrect address information was printed.
ast_sockaddr_stringiy_fmt (which is call by all ast_sockaddr_stringify* functions)
uses thread-local storage for storing the string that it creates. In cases where
ast_sockaddr_stringify_fmt was being called twice within the same statement, the
result of one call would be overwritten by the result of the other call. This
usually was happening in printf-like statements and was resulting in the same
stringified addressed being printed twice instead of two separate addresses.
I have fixed this by using ast_strdupa on the result of stringify functions if
they are used twice within the same statement. As far as I could tell, there were
no instances where a pointer to the result of such a call were saved anywhere, so
this is the only situation I could see where this error could occur.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@276570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r-- | res/res_rtp_asterisk.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 4ab06e4fb..28f75c8b1 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -1999,8 +1999,8 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc &addr); } else { ast_debug(1, "Received RTP packet from %s, dropping due to strict RTP protection. Expected it to be from %s\n", - ast_sockaddr_stringify(&addr), - ast_sockaddr_stringify(&rtp->strict_rtp_address)); + ast_strdupa(ast_sockaddr_stringify(&addr)), + ast_strdupa(ast_sockaddr_stringify(&rtp->strict_rtp_address))); return &ast_null_frame; } } |