@@ -155,7 +155,7 @@ bool dds2tex(const char* dds_path)
155
155
}
156
156
}
157
157
158
- char tex_path [input_path_length ];
158
+ char tex_path [input_path_length + 1 ];
159
159
memcpy (tex_path , dds_path , input_path_length );
160
160
memcpy (tex_path + input_path_length - 4 , ".tex" , 5 );
161
161
FILE * tex_file = fopen (tex_path , "wb" );
@@ -253,7 +253,7 @@ bool tex2dds(const char* tex_path)
253
253
}
254
254
memcpy (ddspf .dwFourCC , dds_format , 4 );
255
255
256
- char dds_path [input_path_length ];
256
+ char dds_path [input_path_length + 1 ];
257
257
memcpy (dds_path , tex_path , input_path_length );
258
258
memcpy (dds_path + input_path_length - 4 , ".dds" , 5 );
259
259
FILE * dds_file = fopen (dds_path , "wb" );
@@ -329,9 +329,9 @@ int main(int argc, char* argv[])
329
329
for (int i = 1 ; i < argc ; i ++ ) {
330
330
input_path_length = strlen (argv [i ]);
331
331
if (input_path_length > 4 ) {
332
- if (strcmp (argv [i ] + input_path_length - 4 , ".dds" ) == 0 ) {
332
+ if (strcasecmp (argv [i ] + input_path_length - 4 , ".dds" ) == 0 ) {
333
333
success = dds2tex (argv [i ]) && success ;
334
- } else if (strcmp (argv [i ] + input_path_length - 4 , ".tex" ) == 0 ) {
334
+ } else if (strcasecmp (argv [i ] + input_path_length - 4 , ".tex" ) == 0 ) {
335
335
success = tex2dds (argv [i ]) && success ;
336
336
} else {
337
337
fprintf (stderr , "Error: \"%s\" is neither a .dds or .tex file!\n" , argv [i ]);
0 commit comments