mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-07 06:39:17 -05:00
Add security checks on file writting
This commit is contained in:
@ -910,6 +910,8 @@ void ExportWaveAsCode(Wave wave, const char *fileName)
|
||||
|
||||
FILE *txtFile = fopen(fileName, "wt");
|
||||
|
||||
if (txtFile != NULL)
|
||||
{
|
||||
fprintf(txtFile, "\n//////////////////////////////////////////////////////////////////////////////////\n");
|
||||
fprintf(txtFile, "// //\n");
|
||||
fprintf(txtFile, "// WaveAsCode exporter v1.0 - Wave data exported as an array of bytes //\n");
|
||||
@ -942,6 +944,7 @@ void ExportWaveAsCode(Wave wave, const char *fileName)
|
||||
|
||||
fclose(txtFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Play a sound
|
||||
void PlaySound(Sound sound)
|
||||
|
||||
@ -849,12 +849,13 @@ void ExportImageAsCode(Image image, const char *fileName)
|
||||
{
|
||||
#define BYTES_TEXT_PER_LINE 20
|
||||
|
||||
FILE *txtFile = fopen(fileName, "wt");
|
||||
|
||||
if (txtFile != NULL)
|
||||
{
|
||||
char varFileName[256] = { 0 };
|
||||
int dataSize = GetPixelDataSize(image.width, image.height, image.format);
|
||||
|
||||
FILE *txtFile = fopen(fileName, "wt");
|
||||
|
||||
fprintf(txtFile, "\n");
|
||||
fprintf(txtFile, "////////////////////////////////////////////////////////////////////////////////////////\n");
|
||||
fprintf(txtFile, "// //\n");
|
||||
fprintf(txtFile, "// ImageAsCode exporter v1.0 - Image pixel data exported as an array of bytes //\n");
|
||||
@ -882,6 +883,7 @@ void ExportImageAsCode(Image image, const char *fileName)
|
||||
|
||||
fclose(txtFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy an image to a new image
|
||||
Image ImageCopy(Image image)
|
||||
|
||||
Reference in New Issue
Block a user