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

@ -124,13 +124,12 @@ static void AddDrive(char *drive, struct stat *stbuf)
/* Add this drive to our list */
i = SDL_numcds;
SDL_cdlist[i] = (char *)SDL_malloc(SDL_strlen(drive)+1);
SDL_cdlist[i] = SDL_strdup(drive);
if (SDL_cdlist[i] == NULL)
{
SDL_OutOfMemory();
return;
}
SDL_strcpy(SDL_cdlist[i], drive);
SDL_cdmode[i] = stbuf->st_rdev;
++SDL_numcds;
}
@ -169,11 +168,11 @@ int SDL_SYS_CDInit(void)
if ( SDLcdrom != NULL )
{
char *cdpath, *delim;
cdpath = SDL_malloc(SDL_strlen(SDLcdrom)+1);
size_t len = SDL_strlen(SDLcdrom)+1;
cdpath = SDL_stack_alloc(len);
if (cdpath != NULL)
{
SDL_strcpy(cdpath, SDLcdrom);
SDL_strlcpy(cdpath, SDLcdrom, len);
SDLcdrom = cdpath;
do {
delim = SDL_strchr(SDLcdrom, ':');
@ -194,7 +193,7 @@ int SDL_SYS_CDInit(void)
SDLcdrom = NULL;
}
} while (SDLcdrom);
SDL_free(cdpath);
SDL_stack_free(cdpath);
}
/* If we found our drives, there's nothing left to do */