summaryrefslogtreecommitdiffstats
path: root/crypto/x509v3
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2017-07-06 06:56:20 +0200
committerPauli <paul.dale@oracle.com>2017-07-07 07:45:55 +0200
commita2371fa93365cc0bc0e46b9d65f3a47a074b1c30 (patch)
treec4751256bc9a1e3d2b20bad3becd6b17aec2c9f4 /crypto/x509v3
parentFix cipher_compare (diff)
downloadopenssl-a2371fa93365cc0bc0e46b9d65f3a47a074b1c30.tar.xz
openssl-a2371fa93365cc0bc0e46b9d65f3a47a074b1c30.zip
Trivial bounds checking.
Bounds checking strpy, strcat and sprintf. These are the remaining easy ones to cover a recently removed commit. Some are trivial, some have been modified and a couple left as they are because the reverted change didn't bounds check properly. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3871)
Diffstat (limited to 'crypto/x509v3')
-rw-r--r--crypto/x509v3/v3_alt.c7
-rw-r--r--crypto/x509v3/v3_info.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c
index 6d4323a12f..598cffd58c 100644
--- a/crypto/x509v3/v3_alt.c
+++ b/crypto/x509v3/v3_alt.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -108,11 +108,12 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
case GEN_IPADD:
p = gen->d.ip->data;
if (gen->d.ip->length == 4)
- sprintf(oline, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
+ BIO_snprintf(oline, sizeof(oline), "%d.%d.%d.%d",
+ p[0], p[1], p[2], p[3]);
else if (gen->d.ip->length == 16) {
oline[0] = 0;
for (i = 0; i < 8; i++) {
- sprintf(htmp, "%X", p[0] << 8 | p[1]);
+ BIO_snprintf(htmp, sizeof(htmp), "%X", p[0] << 8 | p[1]);
p += 2;
strcat(oline, htmp);
if (i != 7)
diff --git a/crypto/x509v3/v3_info.c b/crypto/x509v3/v3_info.c
index 590cbc422a..c2c09499f8 100644
--- a/crypto/x509v3/v3_info.c
+++ b/crypto/x509v3/v3_info.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -82,12 +82,9 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(
ntmp = OPENSSL_malloc(nlen);
if (ntmp == NULL)
goto err;
- strcpy(ntmp, objtmp);
- strcat(ntmp, " - ");
- strcat(ntmp, vtmp->name);
+ BIO_snprintf(ntmp, nlen, "%s - %s", objtmp, vtmp->name);
OPENSSL_free(vtmp->name);
vtmp->name = ntmp;
-
}
if (ret == NULL && tret == NULL)
return sk_CONF_VALUE_new_null();