[openssl] master update

beldmit at gmail.com beldmit at gmail.com
Fri Apr 24 17:06:34 UTC 2020


The branch master has been updated
       via  75e8e2251b3306ebb9a39780fe392f468ec076ea (commit)
      from  01c12100f7d54db29da3fd47dc40c9d0e08c0ab0 (commit)


- Log -----------------------------------------------------------------
commit 75e8e2251b3306ebb9a39780fe392f468ec076ea
Author: Nikolay Morozov <nmorozoff77 at yandex.ru>
Date:   Wed Apr 22 11:45:16 2020 +0300

    Code cleanup in X509v3 String Extentions
    
    Reviewed-by: Ben Kaduk <kaduk at mit.edu>
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
    (Merged from https://github.com/openssl/openssl/pull/11604)

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

Summary of changes:
 crypto/x509/v3_ia5.c  | 6 +++---
 crypto/x509/v3_utf8.c | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/crypto/x509/v3_ia5.c b/crypto/x509/v3_ia5.c
index 23c24e03b2..dc35dd83de 100644
--- a/crypto/x509/v3_ia5.c
+++ b/crypto/x509/v3_ia5.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -29,7 +29,7 @@ char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5)
 {
     char *tmp;
 
-    if (!ia5 || !ia5->length)
+    if (ia5 == NULL || ia5->length == 0)
         return NULL;
     if ((tmp = OPENSSL_malloc(ia5->length + 1)) == NULL) {
         X509V3err(X509V3_F_I2S_ASN1_IA5STRING, ERR_R_MALLOC_FAILURE);
@@ -44,7 +44,7 @@ ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
                                    X509V3_CTX *ctx, const char *str)
 {
     ASN1_IA5STRING *ia5;
-    if (!str) {
+    if (str == NULL) {
         X509V3err(X509V3_F_S2I_ASN1_IA5STRING,
                   X509V3_R_INVALID_NULL_ARGUMENT);
         return NULL;
diff --git a/crypto/x509/v3_utf8.c b/crypto/x509/v3_utf8.c
index df1000def1..b3f87ac51f 100644
--- a/crypto/x509/v3_utf8.c
+++ b/crypto/x509/v3_utf8.c
@@ -36,11 +36,12 @@ char *i2s_ASN1_UTF8STRING(X509V3_EXT_METHOD *method,
         X509V3err(X509V3_F_I2S_ASN1_UTF8STRING, ERR_R_PASSED_NULL_PARAMETER);
         return NULL;
     }
-    if ((tmp = OPENSSL_zalloc(utf8->length + 1)) == NULL) {
+    if ((tmp = OPENSSL_malloc(utf8->length + 1)) == NULL) {
         X509V3err(X509V3_F_I2S_ASN1_UTF8STRING, ERR_R_MALLOC_FAILURE);
         return NULL;
     }
     memcpy(tmp, utf8->data, utf8->length);
+    tmp[utf8->length] = 0;
     return tmp;
 }
 


More information about the openssl-commits mailing list