[openssl-commits] [openssl] master update

Kurt Roeckx kurt at openssl.org
Sat Jun 11 14:47:57 UTC 2016


The branch master has been updated
       via  f3cf2251debba61b568416124736de1d5a7ddc8c (commit)
       via  0a3206539a41f48b24d107449779cdbf5104c1fc (commit)
       via  325cfa8531153641ca0ade876fd29ef482e973a8 (commit)
       via  4b68cb41d1c07ffd21a0fa5da811b1f0d45d7b16 (commit)
       via  8c918b7b9c93ba38790ffd1a83e23c3684e66f57 (commit)
       via  3892b95750b6aa5ed4328a287068f7cdfb9e55bc (commit)
      from  5000a6d1215ea7d6ed6179d0bcd44263f6e3c26b (commit)


- Log -----------------------------------------------------------------
commit f3cf2251debba61b568416124736de1d5a7ddc8c
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Mon Jun 6 22:50:25 2016 +0200

    Avoid creating illegal pointers
    
    Found by tis-interpreter
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    
    GH: #1179

commit 0a3206539a41f48b24d107449779cdbf5104c1fc
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Sun Jun 5 20:51:04 2016 +0200

    include stdlib for malloc() and free()
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    
    GH: #1174

commit 325cfa8531153641ca0ade876fd29ef482e973a8
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Sun Jun 5 20:48:08 2016 +0200

    Don't compare a just free()d pointer
    
    Found by tis-interpreter
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    
    GH: #1173

commit 4b68cb41d1c07ffd21a0fa5da811b1f0d45d7b16
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Sun Jun 5 14:13:33 2016 +0200

    Specify array sizes
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    
    GH: #1172

commit 8c918b7b9c93ba38790ffd1a83e23c3684e66f57
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Sat Jun 4 19:52:28 2016 +0200

    Avoid creating an illegal pointer.
    
    Found by tis-interpreter
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    
    GH: #1166

commit 3892b95750b6aa5ed4328a287068f7cdfb9e55bc
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Sat Jun 4 16:25:39 2016 +0200

    Avoid creating an illegal pointer
    
    Found by tis-interpreter
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    
    GH: #1164

-----------------------------------------------------------------------

Summary of changes:
 crypto/asn1/asn1_par.c  |  3 +--
 crypto/bn/bn_lib.c      | 12 +++++++-----
 crypto/ct/ct_locl.h     |  2 +-
 crypto/ct/ct_x509v3.c   |  2 +-
 crypto/x509/x_name.c    |  4 ++--
 crypto/x509v3/ext_dat.h |  4 ++--
 crypto/x509v3/v3_alt.c  |  2 +-
 crypto/x509v3/v3_ia5.c  |  2 +-
 fuzz/driver.c           |  1 +
 ssl/ssl_lib.c           |  2 +-
 10 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/crypto/asn1/asn1_par.c b/crypto/asn1/asn1_par.c
index 51da014..1e17895 100644
--- a/crypto/asn1/asn1_par.c
+++ b/crypto/asn1/asn1_par.c
@@ -86,8 +86,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
     dump_indent = 6;            /* Because we know BIO_dump_indent() */
     p = *pp;
     tot = p + length;
-    op = p - 1;
-    while ((p < tot) && (op < p)) {
+    while (length > 0) {
         op = p;
         j = ASN1_get_object(&p, &len, &tag, &xclass, length);
         if (j & 0x80) {
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index ccdefb3..90df3ee 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -565,9 +565,9 @@ BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret)
     if (ret == NULL)
         return (NULL);
     bn_check_top(ret);
-    s += len - 1;
+    s += len;
     /* Skip trailing zeroes. */
-    for ( ; len > 0 && *s == 0; s--, len--)
+    for ( ; len > 0 && s[-1] == 0; s--, len--)
         continue;
     n = len;
     if (n == 0) {
@@ -584,7 +584,8 @@ BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret)
     ret->neg = 0;
     l = 0;
     while (n--) {
-        l = (l << 8L) | *(s--);
+        s--;
+        l = (l << 8L) | *s;
         if (m-- == 0) {
             ret->d[--i] = l;
             l = 0;
@@ -610,10 +611,11 @@ int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen)
     /* Add trailing zeroes if necessary */
     if (tolen > i)
         memset(to + i, 0, tolen - i);
-    to += i - 1;
+    to += i;
     while (i--) {
         l = a->d[i / BN_BYTES];
-        *(to--) = (unsigned char)(l >> (8 * (i % BN_BYTES))) & 0xff;
+        to--;
+        *to = (unsigned char)(l >> (8 * (i % BN_BYTES))) & 0xff;
     }
     return tolen;
 }
diff --git a/crypto/ct/ct_locl.h b/crypto/ct/ct_locl.h
index e3ef4b7..1180455 100644
--- a/crypto/ct/ct_locl.h
+++ b/crypto/ct/ct_locl.h
@@ -168,4 +168,4 @@ __owur int SCT_signature_is_complete(const SCT *sct);
 /*
  * Handlers for Certificate Transparency X509v3/OCSP extensions
  */
-extern const X509V3_EXT_METHOD v3_ct_scts[];
+extern const X509V3_EXT_METHOD v3_ct_scts[3];
diff --git a/crypto/ct/ct_x509v3.c b/crypto/ct/ct_x509v3.c
index 4298e1e..805ada0 100644
--- a/crypto/ct/ct_x509v3.c
+++ b/crypto/ct/ct_x509v3.c
@@ -31,7 +31,7 @@ static int i2r_SCT_LIST(X509V3_EXT_METHOD *method, STACK_OF(SCT) *sct_list,
 }
 
 /* Handlers for X509v3/OCSP Certificate Transparency extensions */
-const X509V3_EXT_METHOD v3_ct_scts[] = {
+const X509V3_EXT_METHOD v3_ct_scts[3] = {
     /* X509v3 extension in certificates that contains SCTs */
     { NID_ct_precert_scts, 0, NULL,
     NULL, (X509V3_EXT_FREE)SCT_LIST_free,
diff --git a/crypto/x509/x_name.c b/crypto/x509/x_name.c
index f0b35fb..5c624cb 100644
--- a/crypto/x509/x_name.c
+++ b/crypto/x509/x_name.c
@@ -396,10 +396,10 @@ static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in)
         len--;
     }
 
-    to = from + len - 1;
+    to = from + len;
 
     /* Ignore trailing spaces */
-    while ((len > 0) && !(*to & 0x80) && isspace(*to)) {
+    while ((len > 0) && !(to[-1] & 0x80) && isspace(to[-1])) {
         to--;
         len--;
     }
diff --git a/crypto/x509v3/ext_dat.h b/crypto/x509v3/ext_dat.h
index 332cb87..c9ede96 100644
--- a/crypto/x509v3/ext_dat.h
+++ b/crypto/x509v3/ext_dat.h
@@ -11,7 +11,7 @@ int name_cmp(const char *name, const char *cmp);
 
 extern const X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku;
 extern const X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo;
-extern const X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id;
+extern const X509V3_EXT_METHOD v3_ns_ia5_list[8], v3_alt[3], v3_skey_id, v3_akey_id;
 extern const X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate;
 extern const X509V3_EXT_METHOD v3_delta_crl, v3_cpols, v3_crld, v3_freshest_crl;
 extern const X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff;
@@ -20,5 +20,5 @@ extern const X509V3_EXT_METHOD v3_crl_hold, v3_pci;
 extern const X509V3_EXT_METHOD v3_policy_mappings, v3_policy_constraints;
 extern const X509V3_EXT_METHOD v3_name_constraints, v3_inhibit_anyp, v3_idp;
 extern const X509V3_EXT_METHOD v3_addr, v3_asid;
-extern const X509V3_EXT_METHOD v3_ct_scts[];
+extern const X509V3_EXT_METHOD v3_ct_scts[3];
 extern const X509V3_EXT_METHOD v3_tls_feature;
diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c
index 05dfe36..7778029 100644
--- a/crypto/x509v3/v3_alt.c
+++ b/crypto/x509v3/v3_alt.c
@@ -24,7 +24,7 @@ static int copy_issuer(X509V3_CTX *ctx, GENERAL_NAMES *gens);
 static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx);
 static int do_dirname(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx);
 
-const X509V3_EXT_METHOD v3_alt[] = {
+const X509V3_EXT_METHOD v3_alt[3] = {
     {NID_subject_alt_name, 0, ASN1_ITEM_ref(GENERAL_NAMES),
      0, 0, 0, 0,
      0, 0,
diff --git a/crypto/x509v3/v3_ia5.c b/crypto/x509v3/v3_ia5.c
index 5e230df..c1170d4 100644
--- a/crypto/x509v3/v3_ia5.c
+++ b/crypto/x509v3/v3_ia5.c
@@ -14,7 +14,7 @@
 #include <openssl/x509v3.h>
 #include "ext_dat.h"
 
-const X509V3_EXT_METHOD v3_ns_ia5_list[] = {
+const X509V3_EXT_METHOD v3_ns_ia5_list[8] = {
     EXT_IA5STRING(NID_netscape_base_url),
     EXT_IA5STRING(NID_netscape_revocation_url),
     EXT_IA5STRING(NID_netscape_ca_revocation_url),
diff --git a/fuzz/driver.c b/fuzz/driver.c
index de51574..c530fed 100644
--- a/fuzz/driver.c
+++ b/fuzz/driver.c
@@ -9,6 +9,7 @@
  */
 #include <stdint.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <openssl/opensslconf.h>
 #include "fuzzer.h"
 
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index d4b8335..359260e 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -948,9 +948,9 @@ void SSL_free(SSL *s)
         BIO_free(s->bbio);
         s->bbio = NULL;
     }
-    BIO_free_all(s->rbio);
     if (s->wbio != s->rbio)
         BIO_free_all(s->wbio);
+    BIO_free_all(s->rbio);
 
     BUF_MEM_free(s->init_buf);
 


More information about the openssl-commits mailing list