diff -ur tpm2.0-tools-1.1.0/src/tpm2_getmanufec.cpp tpm2.0-tools-1.1.0-new/src/tpm2_getmanufec.cpp --- tpm2.0-tools-1.1.0/src/tpm2_getmanufec.cpp 2017-04-19 10:35:14.803672435 -0700 +++ tpm2.0-tools-1.1.0-new/src/tpm2_getmanufec.cpp 2017-04-19 19:08:46.515111070 -0700 @@ -385,6 +385,10 @@ } char *weblink = (char*)malloc(1 + strlen(b64h) + strlen(EKserverAddr)); + if (!weblink) { + fprintf(stderr, "Memory allocation failed.\n"); + return -1; + } memset(weblink, 0, (1 + strlen(b64h) + strlen(EKserverAddr))); strcat(weblink, EKserverAddr); strcat(weblink, b64h); @@ -394,6 +398,11 @@ FILE * respfile; respfile = fopen(ECcertFile, "wb"); + if (!respfile) { + fprintf(stderr, "Unable to open file: %s\n", ECcertFile); + free(weblink); + return -1; + } curl_global_init(CURL_GLOBAL_DEFAULT); curl = curl_easy_init();