Check for bad filename in evp_test
authorRich Salz <rsalz@openssl.org>
Fri, 12 Aug 2016 18:04:53 +0000 (14:04 -0400)
committerRich Salz <rsalz@openssl.org>
Fri, 12 Aug 2016 18:04:53 +0000 (14:04 -0400)
Thanks to Brian Carpter for reporting this.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
test/evp_test.c

index f820e25..a0dbffb 100644 (file)
@@ -559,6 +559,10 @@ int main(int argc, char **argv)
     memset(&t, 0, sizeof(t));
     t.start_line = -1;
     in = BIO_new_file(argv[1], "r");
+    if (in == NULL) {
+        fprintf(stderr, "Can't open %s for reading\n", argv[1]);
+        return 1;
+    }
     t.in = in;
     while (BIO_gets(in, buf, sizeof(buf))) {
         t.line++;