[Freeswitch-svn] [commit] r11621 - freeswitch/trunk/src/mod/applications/mod_lcr

FreeSWITCH SVN rupa at freeswitch.org
Tue Feb 3 13:41:48 PST 2009


Author: rupa
Date: Tue Feb  3 15:41:48 2009
New Revision: 11621

Log:
protect switch_core_strdup from null db values


Modified:
   freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c

Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c	Tue Feb  3 15:41:48 2009
@@ -296,16 +296,16 @@
 	additional = switch_core_alloc(pool, sizeof(lcr_obj_t));
 
 	additional->digit_len = strlen(argv[LCR_DIGITS_PLACE]);
-	additional->digit_str = switch_core_strdup(pool, argv[LCR_DIGITS_PLACE]);
-	additional->suffix = switch_core_strdup(pool, argv[LCR_SUFFIX_PLACE]);
-	additional->prefix = switch_core_strdup(pool, argv[LCR_PREFIX_PLACE]);
-	additional->carrier_name = switch_core_strdup(pool, argv[LCR_CARRIER_PLACE]);
-	additional->rate = (float)atof(argv[LCR_RATE_PLACE]);
+	additional->digit_str = switch_core_strdup(pool, switch_str_nil(argv[LCR_DIGITS_PLACE]));
+	additional->suffix = switch_core_strdup(pool, switch_str_nil(argv[LCR_SUFFIX_PLACE]));
+	additional->prefix = switch_core_strdup(pool, switch_str_nil(argv[LCR_PREFIX_PLACE]));
+	additional->carrier_name = switch_core_strdup(pool, switch_str_nil(argv[LCR_CARRIER_PLACE]));
+	additional->rate = (float)atof(switch_str_nil(argv[LCR_RATE_PLACE]));
 	additional->rate_str = switch_core_sprintf(pool, "%0.5f", additional->rate);
-	additional->gw_prefix = switch_core_strdup(pool, argv[LCR_GW_PREFIX_PLACE]);
-	additional->gw_suffix = switch_core_strdup(pool, argv[LCR_GW_SUFFIX_PLACE]);
-	additional->lstrip = atoi(argv[LCR_LSTRIP_PLACE]);
-	additional->tstrip = atoi(argv[LCR_TSTRIP_PLACE]);
+	additional->gw_prefix = switch_core_strdup(pool, switch_str_nil(argv[LCR_GW_PREFIX_PLACE]));
+	additional->gw_suffix = switch_core_strdup(pool, switch_str_nil(argv[LCR_GW_SUFFIX_PLACE]));
+	additional->lstrip = atoi(switch_str_nil(argv[LCR_LSTRIP_PLACE]));
+	additional->tstrip = atoi(switch_str_nil(argv[LCR_TSTRIP_PLACE]));
 	additional->dialstring = get_bridge_data(pool, cbt->lookup_number, additional);
 
 	if (cbt->head == NULL) {



More information about the Freeswitch-svn mailing list