summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-05-20 09:14:30 +0200
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-06-13 15:13:21 +0200
commit7e998a0fdcbc59ef527ae84338439af75986c96a (patch)
treea384acabf7f7ff9f8fc0e0b4cc812d5b249dc9f9 /apps
parentCheck expected sender not only for signature-protected CMP messages (diff)
downloadopenssl-7e998a0fdcbc59ef527ae84338439af75986c96a.tar.xz
openssl-7e998a0fdcbc59ef527ae84338439af75986c96a.zip
Correct error output of parse_name() in apps/lib/apps.c and apps/cmp.c
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11998)
Diffstat (limited to 'apps')
-rw-r--r--apps/cmp.c2
-rw-r--r--apps/lib/apps.c13
2 files changed, 8 insertions, 7 deletions
diff --git a/apps/cmp.c b/apps/cmp.c
index ef780f7e22..6f3e7ed39e 100644
--- a/apps/cmp.c
+++ b/apps/cmp.c
@@ -2221,7 +2221,7 @@ static int setup_client_ctx(OSSL_CMP_CTX *ctx, ENGINE *e)
if (!set_name(opt_recipient, OSSL_CMP_CTX_set1_recipient, ctx, "recipient")
|| !set_name(opt_expect_sender, OSSL_CMP_CTX_set1_expected_sender,
ctx, "expected sender"))
- goto oom;
+ goto err;
if (opt_geninfo != NULL && !handle_opt_geninfo(ctx))
goto err;
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index 6fd27c3665..6c9d62fb62 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -1631,7 +1631,7 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
goto err;
}
- while (*cp) {
+ while (*cp != '\0') {
char *bp = work;
char *typestr = bp;
unsigned char *valstr;
@@ -1640,12 +1640,12 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
nextismulti = 0;
/* Collect the type */
- while (*cp && *cp != '=')
+ while (*cp != '\0' && *cp != '=')
*bp++ = *cp++;
if (*cp == '\0') {
BIO_printf(bio_err,
- "%s: Hit end of string before finding the '='\n",
- opt_getprog());
+ "%s: Hit end of string before finding the '='\n",
+ opt_getprog());
goto err;
}
*bp++ = '\0';
@@ -1653,7 +1653,7 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
/* Collect the value. */
valstr = (unsigned char *)bp;
- for (; *cp && *cp != '/'; *bp++ = *cp++) {
+ for (; *cp != '\0' && *cp != '/'; *bp++ = *cp++) {
if (canmulti && *cp == '+') {
nextismulti = 1;
break;
@@ -1668,7 +1668,7 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
*bp++ = '\0';
/* If not at EOS (must be + or /), move forward. */
- if (*cp)
+ if (*cp != '\0')
++cp;
/* Parse */
@@ -1687,6 +1687,7 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
if (!X509_NAME_add_entry_by_NID(n, nid, chtype,
valstr, strlen((char *)valstr),
-1, ismulti ? -1 : 0)) {
+ ERR_print_errors(bio_err);
BIO_printf(bio_err, "%s: Error adding name attribute \"/%s=%s\"\n",
opt_getprog(), typestr ,valstr);
goto err;