From ea5679f8f20fdefe095ce68baeda5191ad2e67c4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 12 Aug 2008 20:54:51 +0000 Subject: [PATCH] fix sqlite issue with select of the sip contact git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9286 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia_reg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index f0025e2daf..37ba36a323 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -414,6 +414,7 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot) char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const char *host, char *val, switch_size_t len) { struct callback_t cbt = { 0 }; + char sql[512] = ""; if (!user) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Called with null user!\n"); @@ -424,13 +425,13 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c cbt.len = len; if (host) { - switch_snprintf(val, len, "select contact from sip_registrations where sip_user='%s' and sip_host='%s'", user, host); + switch_snprintf(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%s' and sip_host='%s'", user, host); } else { - switch_snprintf(val, len, "select contact from sip_registrations where sip_user='%s'", user); + switch_snprintf(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%s'", user); } - sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, val, sofia_reg_find_callback, &cbt); + sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_reg_find_callback, &cbt); if (cbt.matches) {