gbaconv

A set of tools aimed at GameBoy Advance developers
Log | Files | Refs | README | LICENSE

commit f716e0b34f600d530d72a5b9d16bea109b489c1b
parent 678019e771e8ab6a576027916971dbe0cf61fc3c
Author: Frederic Cambus <fred@statdns.com>
Date:   Thu, 21 Feb 2019 23:17:49 +0100

Add format validation check for PCX files.

Diffstat:
Mpcx2gba.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/pcx2gba.c b/pcx2gba.c @@ -84,6 +84,11 @@ int main(int argc, char *argv[]) { fread(input_file_buffer, input_file_size, 1, input_file); fclose(input_file); + if (input_file_size < PCX_HEADER_LENGTH) { + printf("ERROR: Input File is not a PCX file\n\n"); + return -1; + } + /* Check that the file is a valid 8-bpp PCX */ memcpy(&pcx_header, input_file_buffer, PCX_HEADER_LENGTH);