[asterisk-commits] russell: trunk r41034 - /trunk/channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Aug 24 19:55:01 MST 2006


Author: russell
Date: Thu Aug 24 21:55:00 2006
New Revision: 41034

URL: http://svn.digium.com/view/asterisk?rev=41034&view=rev
Log:
don't seg fault when using dbsecret

Modified:
    trunk/channels/chan_iax2.c

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=41034&r1=41033&r2=41034&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Thu Aug 24 21:55:00 2006
@@ -4743,19 +4743,21 @@
 		/* Keep this check last */
 		if (!ast_strlen_zero(user->dbsecret)) {
 			char *family, *key=NULL;
+			char buf[80];
 			family = ast_strdupa(user->dbsecret);
 			key = strchr(family, '/');
 			if (key) {
 				*key = '\0';
 				key++;
 			}
-			if (!key || ast_db_get(family, key, (char*)iaxs[callno]->secret, sizeof(iaxs[callno]->secret))) {
+			if (!key || ast_db_get(family, key, buf, sizeof(buf))) {
 				ast_log(LOG_WARNING, "Unable to retrieve database password for family/key '%s'!\n", user->dbsecret);
 				if (ast_test_flag(user, IAX_TEMPONLY)) {
 					destroy_user(user);
 					user = NULL;
 				}
-			}
+			} else
+				ast_string_field_set(iaxs[callno], secret, buf);
 		} else
 			ast_string_field_set(iaxs[callno], secret, user->secret);
 		res = 0;



More information about the asterisk-commits mailing list