From b738aaa83465e64ab3e22e03cb9f9a554240c8d4 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Mon, 23 Mar 2020 17:17:17 +0100 Subject: [PATCH] tiffset: check memory allocation fixes #157 / http://bugzilla.maptools.org/show_bug.cgi?id=2850 --- tools/tiffset.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/tiffset.c b/tools/tiffset.c index fdfdf3cc..f32af23f 100644 --- a/tools/tiffset.c +++ b/tools/tiffset.c @@ -343,6 +343,12 @@ main(int argc, char* argv[]) } text = (char *) malloc(1000000); + if(text == NULL) { + fprintf( stderr, + "Memory allocation error\n"); + fclose( fp ); + continue; + } len = fread( text, 1, 999999, fp ); text[len] = '\0';