summaryrefslogtreecommitdiffstats
path: root/apps/cms.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-08-24 11:22:47 +0100
committerMatt Caswell <matt@openssl.org>2016-08-24 11:22:47 +0100
commit08f6ae5b2896a22e1e16de3e363d1ea314700b0b (patch)
tree97d2c6f63c58d127ee059da8fd326a551cd1bc69 /apps/cms.c
parentc74aea8d6ccdf07ce826a9451887739b8aa64096 (diff)
Fix some resource leaks in the apps
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'apps/cms.c')
-rw-r--r--apps/cms.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/cms.c b/apps/cms.c
index 52186d2c03..9c41a97ec5 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -412,6 +412,11 @@ int cms_main(int argc, char **argv)
noout = print = 1;
break;
case OPT_SECRETKEY:
+ if (secret_key != NULL) {
+ /* Cannot be supplied twice */
+ BIO_printf(bio_err, "Invalid key %s\n", opt_arg());
+ goto opthelp;
+ }
secret_key = OPENSSL_hexstr2buf(opt_arg(), &ltmp);
if (secret_key == NULL) {
BIO_printf(bio_err, "Invalid key %s\n", opt_arg());
@@ -420,6 +425,11 @@ int cms_main(int argc, char **argv)
secret_keylen = (size_t)ltmp;
break;
case OPT_SECRETKEYID:
+ if (secret_keyid != NULL) {
+ /* Cannot be supplied twice */
+ BIO_printf(bio_err, "Invalid id %s\n", opt_arg());
+ goto opthelp;
+ }
secret_keyid = OPENSSL_hexstr2buf(opt_arg(), &ltmp);
if (secret_keyid == NULL) {
BIO_printf(bio_err, "Invalid id %s\n", opt_arg());
@@ -431,6 +441,11 @@ int cms_main(int argc, char **argv)
pwri_pass = (unsigned char *)opt_arg();
break;
case OPT_ECONTENT_TYPE:
+ if (econtent_type != NULL) {
+ /* Cannot be supplied twice */
+ BIO_printf(bio_err, "Invalid OID %s\n", opt_arg());
+ goto opthelp;
+ }
econtent_type = OBJ_txt2obj(opt_arg(), 0);
if (econtent_type == NULL) {
BIO_printf(bio_err, "Invalid OID %s\n", opt_arg());