Author: anthm Date: Tue Aug 22 10:48:35 2006 New Revision: 2358 Modified: freeswitch/trunk/src/switch_stun.c Log: Fix issue pointed out by Fanzhou Zhao <fanzhou@gmail.com> Modified: freeswitch/trunk/src/switch_stun.c ============================================================================== --- freeswitch/trunk/src/switch_stun.c (original) +++ freeswitch/trunk/src/switch_stun.c Tue Aug 22 10:48:35 2006 @@ -24,6 +24,7 @@ * Contributor(s): * * Anthony Minessale II <anthmct@yahoo.com> + * Fanzhou Zhao <fanzhou@gmail.com> 2006-08-22 (Bugfix 2357-2358) * * * switch_stun.c STUN (Simple Traversal of UDP over NAT) @@ -91,18 +92,18 @@ { char chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; int max; - uint8_t x; + uint16_t x; if (!set) { set = chars; } - max = (int)strlen(set) - 1; + max = (int)strlen(set); srand((unsigned int)apr_time_now()); for(x = 0; x < len; x++) { - int j = 1+(int)(max*1.0*rand()/(RAND_MAX+1.0)); + int j = (int)(max*1.0*rand()/(RAND_MAX+1.0)); buf[x] = set[j]; } }
participants (1)
-
Freeswitch SVN