mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-20 03:26:55 +00:00
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
This commit is contained in:
@@ -529,8 +529,8 @@ int ast_ouraddrfor(const struct ast_sockaddr *them, struct ast_sockaddr *us)
|
||||
}
|
||||
close(s);
|
||||
ast_debug(3, "For destination '%s', our source address is '%s'.\n",
|
||||
ast_sockaddr_stringify_addr(them),
|
||||
ast_sockaddr_stringify_addr(us));
|
||||
ast_strdupa(ast_sockaddr_stringify_addr(them)),
|
||||
ast_strdupa(ast_sockaddr_stringify_addr(us)));
|
||||
|
||||
ast_sockaddr_set_port(us, port);
|
||||
|
||||
|
Reference in New Issue
Block a user