From ae8212ad5d3413e4c5b3397ab4bb782fdea1a194 Mon Sep 17 00:00:00 2001 From: red031000 Date: Fri, 17 Jul 2020 22:29:41 +0100 Subject: fix strcat --- tools/nitrogfx/gfx.c | 8 ++++++-- 1 file 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; -- cgit v1.2.3