050-segfault_configfile.patch revision 6276
6276N/A# This patch was developed in house.
6276N/A# The issue is fixed in the OpenSSL 1.1 release by the upstream,
6276N/A# but the code base has changed and the same fix can't be applied
6276N/A# without major code change.
6276N/A--- a/apps/ts.c 2016-06-21 13:43:24.299079900 -0700
6276N/A+++ b/apps/ts.c 2016-06-21 14:06:28.055910010 -0700
6276N/A@@ -299,6 +299,9 @@
6276N/A goto usage;
6276N/A /* Load the config file for possible policy OIDs. */
6276N/A conf = load_config_file(configfile);
6276N/A+ if (conf == NULL) {
6276N/A+ goto cleanup;
6276N/A+ }
6276N/A ret = !query_command(data, digest, md, policy, no_nonce, cert,
6276N/A in, out, text);
6276N/A break;
6276N/A@@ -401,6 +404,7 @@
6276N/A else
6276N/A BIO_printf(bio_err, "error on line %ld of config file "
6276N/A "'%s'\n", errorline, configfile);
6276N/A+ goto errexit;
6276N/A }
6276N/A
6276N/A if (conf != NULL) {
6276N/A@@ -410,18 +414,27 @@
6276N/A p = NCONF_get_string(conf, NULL, ENV_OID_FILE);
6276N/A if (p != NULL) {
6276N/A BIO *oid_bio = BIO_new_file(p, "r");
6276N/A- if (!oid_bio)
6276N/A+ if (!oid_bio) {
6276N/A ERR_print_errors(bio_err);
6276N/A- else {
6276N/A+ goto errexit;
6276N/A+ } else {
6276N/A OBJ_create_objects(oid_bio);
6276N/A BIO_free_all(oid_bio);
6276N/A }
6276N/A } else
6276N/A ERR_clear_error();
6276N/A- if (!add_oid_section(bio_err, conf))
6276N/A+ if (!add_oid_section(bio_err, conf)) {
6276N/A ERR_print_errors(bio_err);
6276N/A+ goto errexit;
6276N/A+ }
6276N/A }
6276N/A return conf;
6276N/A+
6276N/A+errexit:
6276N/A+ if (conf != NULL) {
6276N/A+ NCONF_free(conf);
6276N/A+ }
6276N/A+ return (NULL);
6276N/A }
6276N/A
6276N/A /*