File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2
Generals/Code/Libraries/Source/WWVegas/WW3D2 Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2403,9 +2403,10 @@ IDirect3DSurface8 * DX8Wrapper::_Create_DX8_Surface(const char *filename_)
2403
2403
// If file not found, try the dds format
2404
2404
// else create a surface with missing texture in it
2405
2405
char compressed_name[200 ];
2406
- strncpy (compressed_name,filename_, 200 );
2406
+ strncpy (compressed_name,filename_, ARRAY_SIZE (compressed_name));
2407
+ compressed_name[ARRAY_SIZE (compressed_name)-1 ] = ' \0 ' ;
2407
2408
char *ext = strstr (compressed_name, " ." );
2408
- if ( (strlen (ext)==4 ) &&
2409
+ if ( ext && (strlen (ext)==4 ) &&
2409
2410
( (ext[1 ] == ' t' ) || (ext[1 ] == ' T' ) ) &&
2410
2411
( (ext[2 ] == ' g' ) || (ext[2 ] == ' G' ) ) &&
2411
2412
( (ext[3 ] == ' a' ) || (ext[3 ] == ' A' ) ) ) {
Original file line number Diff line number Diff line change @@ -2942,9 +2942,10 @@ IDirect3DSurface8 * DX8Wrapper::_Create_DX8_Surface(const char *filename_)
2942
2942
// If file not found, try the dds format
2943
2943
// else create a surface with missing texture in it
2944
2944
char compressed_name[200 ];
2945
- strncpy (compressed_name,filename_, 200 );
2945
+ strncpy (compressed_name,filename_, ARRAY_SIZE (compressed_name));
2946
+ compressed_name[ARRAY_SIZE (compressed_name)-1 ] = ' \0 ' ;
2946
2947
char *ext = strstr (compressed_name, " ." );
2947
- if ( (strlen (ext)==4 ) &&
2948
+ if ( ext && (strlen (ext)==4 ) &&
2948
2949
( (ext[1 ] == ' t' ) || (ext[1 ] == ' T' ) ) &&
2949
2950
( (ext[2 ] == ' g' ) || (ext[2 ] == ' G' ) ) &&
2950
2951
( (ext[3 ] == ' a' ) || (ext[3 ] == ' A' ) ) ) {
You can’t perform that action at this time.
0 commit comments