Use only safe string functions

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401383
This commit is contained in:
Sam Lantinga 2006-02-19 23:46:34 +00:00
parent a81db3ea34
commit 1da8cb0143
60 changed files with 223 additions and 263 deletions

View file

@ -53,7 +53,7 @@ int SDL_putenv(const char *variable)
SDL_envmem = newmem;
SDL_envmemlen = bufferlen;
}
SDL_strcpy(SDL_envmem, variable);
SDL_strlcpy(SDL_envmem, variable, bufferlen);
value = SDL_envmem + (sep - variable);
*value++ = '\0';
if ( !SetEnvironmentVariable(SDL_envmem, *value ? value : NULL) ) {
@ -111,11 +111,10 @@ int SDL_putenv(const char *variable)
}
/* Allocate memory for the variable */
new_variable = (char *)SDL_malloc(SDL_strlen(variable)+1);
new_variable = SDL_strdup(variable);
if ( ! new_variable ) {
return(-1);
}
SDL_strcpy(new_variable, variable);
/* Actually put it into the environment */
added = 0;