diff --git a/src/bin/mj2/opj_mj2_extract.c b/src/bin/mj2/opj_mj2_extract.c index 9384dc6d..84d835e4 100644 --- a/src/bin/mj2/opj_mj2_extract.c +++ b/src/bin/mj2/opj_mj2_extract.c @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) mj2_sample_t *sample; unsigned char* frame_codestream; FILE *file, *outfile; - char outfilename[50]; + char outfilename[FILENAME_MAX]; mj2_dparameters_t parameters; if (argc != 3) { @@ -91,6 +91,11 @@ int main(int argc, char *argv[]) return 1; } + if(strlen(argv[2]) + 11 > sizeof(outfilename)) { + fprintf(stderr,"filename %d too long\n",strlen(argv[2]) + 11); + return 1; + } + file = fopen(argv[1], "rb"); if (!file) {