[Freeswitch-svn] [commit] r4198 - freeswitch/trunk/src/mod/languages/mod_spidermonkey
Freeswitch SVN
anthm at freeswitch.org
Sat Feb 10 19:39:46 EST 2007
Author: anthm
Date: Sat Feb 10 19:39:46 2007
New Revision: 4198
Modified:
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
Log:
minor update
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Sat Feb 10 19:39:46 2007
@@ -1282,9 +1282,8 @@
{
struct js_session *jss = JS_GetPrivate(cx, obj);
char *terminators = NULL;
- char buf[128] = "";
- int digits;
- int32 timeout = 5000;
+ char buf[513] = {0};
+ int32 digits = 0, timeout = 5000;
switch_channel_t *channel;
channel = switch_core_session_get_channel(jss->session);
@@ -1299,7 +1298,13 @@
if (argc > 0) {
char term;
- digits = atoi(JS_GetStringBytes(JS_ValueToString(cx, argv[0])));
+ JS_ValueToInt32(cx, argv[0], &digits);
+
+ if (digits > sizeof(buf) - 1) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exceeded max digits of %d\n", sizeof(buf) - 1);
+ return JS_FALSE;
+ }
+
if (argc > 1) {
terminators = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
}
More information about the Freeswitch-svn
mailing list