summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2006-01-25 19:16:14 +0000
committerRussell Bryant <russell@russellbryant.com>2006-01-25 19:16:14 +0000
commitc1a2631101c2e2c37e4506a2d1ea0d7dcf7571b4 (patch)
tree1ec7fe4e1c102e32840a1d3f52a81f290dca2c37 /channels
parent19f99bee0f14e9caaba3dd3971f4773c7caa9d20 (diff)
Merged revisions 8677 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r8677 | russell | 2006-01-25 14:14:43 -0500 (Wed, 25 Jan 2006) | 3 lines don't call ast_update_realtime with uninitialized variables if we get a registration with an expirey of 0 seconds (issue #6173) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8678 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 0d5c4df8d..845769dfe 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1596,16 +1596,15 @@ static void realtime_update_peer(const char *peername, struct sockaddr_in *sin,
{
char port[10];
char ipaddr[20];
- char regseconds[20] = "0";
+ char regseconds[20];
+ time_t nowtime;
+
+ time(&nowtime);
+ nowtime += expirey;
+ snprintf(regseconds, sizeof(regseconds), "%d", (int)nowtime); /* Expiration time */
+ ast_inet_ntoa(ipaddr, sizeof(ipaddr), sin->sin_addr);
+ snprintf(port, sizeof(port), "%d", ntohs(sin->sin_port));
- if (expirey) { /* Registration */
- time_t nowtime;
- time(&nowtime);
- nowtime += expirey;
- snprintf(regseconds, sizeof(regseconds), "%d", (int)nowtime); /* Expiration time */
- ast_inet_ntoa(ipaddr, sizeof(ipaddr), sin->sin_addr);
- snprintf(port, sizeof(port), "%d", ntohs(sin->sin_port));
- }
if (fullcontact)
ast_update_realtime("sippeers", "name", peername, "ipaddr", ipaddr, "port", port, "regseconds", regseconds, "username", username, "fullcontact", fullcontact, NULL);
else