EBCDIC bug fix from main branch.
authorUlf Möller <ulf@openssl.org>
Wed, 7 Feb 2001 22:13:10 +0000 (22:13 +0000)
committerUlf Möller <ulf@openssl.org>
Wed, 7 Feb 2001 22:13:10 +0000 (22:13 +0000)
CHANGES
crypto/x509v3/v3_prn.c

diff --git a/CHANGES b/CHANGES
index 0a35672434785f383658320359efdc47d4a1d421..6234386c7489303441530097a1d78e86a346e3d7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,9 @@
      return NULL from CONF_get_section.
      [Bodo Moeller]
 
+  *) Fix potential buffer overrun for EBCDIC.
+     [Ulf Moeller]
+
   *) Tolerate nonRepudiation as being valid for S/MIME signing and certSign
      keyUsage if basicConstraints absent for a CA.
      [Steve Henson]
index dbc4fb1f160009d575d919c689a40f9afac25c0b..14b804c4ad33e4f6e2ed4ca3c1e54bef38098fa2 100644 (file)
@@ -85,9 +85,16 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml)
                else BIO_printf(out, "%s:%s", nval->name, nval->value);
 #else
                else {
-                       char tmp[10240]; /* 10k is BIO_printf's limit anyway */
-                       ascii2ebcdic(tmp, nval->value, strlen(nval->value)+1);
-                       BIO_printf(out, "%s:%s", nval->name, tmp);
+                       int len;
+                       char *tmp;
+                       len = strlen(nval->value)+1;
+                       tmp = OPENSSL_malloc(len);
+                       if (tmp)
+                       {
+                               ascii2ebcdic(tmp, nval->value, len);
+                               BIO_printf(out, "%s:%s", nval->name, tmp);
+                               OPENSSL_free(tmp);
+                       }
                }
 #endif
                if(ml) BIO_puts(out, "\n");
@@ -115,9 +122,16 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, int flag, int indent)
                BIO_printf(out, "%*s%s", indent, "", value);
 #else
                {
-                       char tmp[10240]; /* 10k is BIO_printf's limit anyway */
-                       ascii2ebcdic(tmp, value, strlen(value)+1);
-                       BIO_printf(out, "%*s%s", indent, "", tmp);
+                       int len;
+                       char *tmp;
+                       len = strlen(value)+1;
+                       tmp = OPENSSL_malloc(len);
+                       if (tmp)
+                       {
+                               ascii2ebcdic(tmp, value, len);
+                               BIO_printf(out, "%*s%s", indent, "", tmp);
+                               OPENSSL_free(tmp);
+                       }
                }
 #endif
        } else if(method->i2v) {