Replace strcpys with strlcpy (except for librsound.c)

This commit is contained in:
twinaphex 2012-07-29 18:38:55 +02:00
parent 22dc1b9e72
commit c92c08ff31
2 changed files with 6 additions and 9 deletions

View File

@ -120,7 +120,7 @@ HRESULT CIoSupport::Remount(CHAR* szDrive, CHAR* szDevice)
HRESULT CIoSupport::Remap(CHAR* szMapping)
{
char szMap[32];
strcpy(szMap, szMapping );
strlcpy(szMap, szMapping, sizeof(szMap));
char* pComma = strstr(szMap, ",");
if (pComma)

View File

@ -92,7 +92,8 @@ static __forceinline void FreeContiguousMemory( void* pData )
#ifdef _XBOX1
char g_strMediaPath[512] = "D:\\Media\\";
static HRESULT FindMediaFile( char *strPath, const char *strFilename )
static HRESULT FindMediaFile( char *strPath, const char *strFilename, size_t strPathsize)
{
// Check for valid arguments
if( strFilename == NULL || strPath == NULL )
@ -102,7 +103,7 @@ static HRESULT FindMediaFile( char *strPath, const char *strFilename )
}
// Default path is the filename itself as a fully qualified path
strcpy( strPath, strFilename );
strlcpy( strPath, strFilename, strPathsize);
// Check for the ':' character to see if the filename is a fully
// qualified path. If not, pre-pend the media directory
@ -115,11 +116,7 @@ static HRESULT FindMediaFile( char *strPath, const char *strFilename )
if( hFile == INVALID_HANDLE_VALUE )
{
// Return error
CHAR strBuffer[80];
sprintf( strBuffer, "FindMediaFile(): Could not find file [%s]\n",
strFilename );
RARCH_ERR( strBuffer );
RARCH_ERR("FindMediaFile(): Could not find file.\n");
return 0x82000004;
}
@ -143,7 +140,7 @@ HRESULT PackedResource::Create( const char *strFilename )
// Find the media file
CHAR strResourcePath[512];
if( FAILED( FindMediaFile( strResourcePath, strFilename ) ) )
if( FAILED(FindMediaFile(strResourcePath, strFilename, sizeof(strResourcePath))))
return E_FAIL;
else
strFilename = strResourcePath;