diff 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
line wrap: on
line diff
--- a/src/video/x11/SDL_x11mouse.c	Sun Feb 19 23:38:57 2006 +0000
+++ b/src/video/x11/SDL_x11mouse.c	Sun Feb 19 23:46:34 2006 +0000
@@ -191,14 +191,16 @@
 static void SetMouseAccel(_THIS, const char *accel_param)
 {
 	int i;
+	size_t len;
 	int accel_value[3];
 	char *mouse_param, *mouse_param_buf, *pin;
 
-	mouse_param_buf = (char *)SDL_malloc(SDL_strlen(accel_param)+1);
+	len = SDL_strlen(accel_param)+1;
+	mouse_param_buf = SDL_stack_alloc(char, len);
 	if ( ! mouse_param_buf ) {
 		return;
 	}
-	SDL_strcpy(mouse_param_buf, accel_param);
+	SDL_strlcpy(mouse_param_buf, accel_param, len);
 	mouse_param = mouse_param_buf;
 
 	for ( i=0; (i < 3) && mouse_param; ++i ) {