diff options
author | red031000 <rubenru09@aol.com> | 2020-07-17 22:29:41 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-07-17 22:29:41 +0100 |
commit | ae8212ad5d3413e4c5b3397ab4bb782fdea1a194 (patch) | |
tree | 089659606d8544971b319d56659dbe926605852b | |
parent | e0e55af2c9dea2a8b55cd95d69b08bc2ab9d5912 (diff) |
fix strcat
-rw-r--r-- | tools/nitrogfx/gfx.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/nitrogfx/gfx.c b/tools/nitrogfx/gfx.c index c47b5903..56abc694 100644 --- a/tools/nitrogfx/gfx.c +++ b/tools/nitrogfx/gfx.c @@ -362,7 +362,9 @@ void ReadNtrImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, i FATAL_ERROR("8bpp is not implemented yet\n"); break; } - FILE *fp = fopen(strcat(path, ".key"), "wb"); + char string[strlen(path) + 6]; + strcpy(string, path); + FILE *fp = fopen(strcat(string, ".key"), "wb"); if (fp == NULL) FATAL_ERROR("Failed to open key file for writing.\n"); fwrite(&key, 4, 1, fp); @@ -478,7 +480,9 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in if (scanned) { - FILE *fp2 = fopen(strcat(path, ".key"), "rb"); + char string[strlen(path) + 6]; + strcpy(string, path); + FILE *fp2 = fopen(strcat(string, ".key"), "rb"); if (fp2 == NULL) FATAL_ERROR("Failed to open key file for reading.\n"); uint32_t key; |