Revision
16909
Author
brian
Date
2010-03-04 17:51:48 -0600 (Thu, 04 Mar 2010)

Log Message

MODLANG-159 and MODLANG-162

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c (16908 => 16909)


--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c	2010-03-04 23:28:06 UTC (rev 16908)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c	2010-03-04 23:51:48 UTC (rev 16909)
@@ -169,11 +169,16 @@
 	struct teletone_obj *tto = JS_GetPrivate(cx, obj);
 	if (argc > 2) {
 		int x;
+        int nMax = argc;
 		char *fval;
 		char *map_str;
 		map_str = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 
-		for (x = 1; x < TELETONE_MAX_TONES; x++) {
+		if ( TELETONE_MAX_TONES < nMax ) {
+			nMax = TELETONE_MAX_TONES;
+		}
+
+		for (x = 1; x < nMax; x++) {
 			fval = JS_GetStringBytes(JS_ValueToString(cx, argv[x]));
 			tto->ts.TONES[(int) *map_str].freqs[x - 1] = strtod(fval, NULL);
 		}