comparison src/video/x11/SDL_x11mouse.c @ 1379:c0a74f199ecf

Use only safe string functions
author Sam Lantinga <slouken@libsdl.org>
date Sun, 19 Feb 2006 23:46:34 +0000
parents 19418e4422cb
children d910939febfa
comparison
equal deleted inserted replaced
1378:dc0e13e7e1ae 1379:c0a74f199ecf
189 denumenator and threshold. 189 denumenator and threshold.
190 */ 190 */
191 static void SetMouseAccel(_THIS, const char *accel_param) 191 static void SetMouseAccel(_THIS, const char *accel_param)
192 { 192 {
193 int i; 193 int i;
194 size_t len;
194 int accel_value[3]; 195 int accel_value[3];
195 char *mouse_param, *mouse_param_buf, *pin; 196 char *mouse_param, *mouse_param_buf, *pin;
196 197
197 mouse_param_buf = (char *)SDL_malloc(SDL_strlen(accel_param)+1); 198 len = SDL_strlen(accel_param)+1;
199 mouse_param_buf = SDL_stack_alloc(char, len);
198 if ( ! mouse_param_buf ) { 200 if ( ! mouse_param_buf ) {
199 return; 201 return;
200 } 202 }
201 SDL_strcpy(mouse_param_buf, accel_param); 203 SDL_strlcpy(mouse_param_buf, accel_param, len);
202 mouse_param = mouse_param_buf; 204 mouse_param = mouse_param_buf;
203 205
204 for ( i=0; (i < 3) && mouse_param; ++i ) { 206 for ( i=0; (i < 3) && mouse_param; ++i ) {
205 pin = SDL_strchr(mouse_param, '/'); 207 pin = SDL_strchr(mouse_param, '/');
206 if ( pin ) { 208 if ( pin ) {