[openssl-commits] [openssl] master update

bernd.edlinger at hotmail.de bernd.edlinger at hotmail.de
Tue Apr 3 14:03:42 UTC 2018


The branch master has been updated
       via  1518c55a796b058eff01f3cbf177f4b726c01d7c (commit)
       via  21db0e1afdcf17a189ebe49af3506551b108a2f2 (commit)
       via  16e1eea6a67c85c9d786f3c4448182b1aca101b8 (commit)
       via  18ada952d1dcea8dfc5008df9f317b3eb47c13fa (commit)
       via  b998745a4596c05f673ed8acdcaedcb4c5e208ad (commit)
       via  752837e0664e990b5edf6f0b69e1b4612efadce0 (commit)
       via  4f090f76a412a0f69f85621468bd445ea6a65af6 (commit)
      from  f4b076e6e683d36ebeb496f15c06020e0b9bdccd (commit)


- Log -----------------------------------------------------------------
commit 1518c55a796b058eff01f3cbf177f4b726c01d7c
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Mon Apr 2 10:54:52 2018 +0200

    Change the "offset too large" message to more generic wording
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
    (Merged from https://github.com/openssl/openssl/pull/5826)

commit 21db0e1afdcf17a189ebe49af3506551b108a2f2
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Mon Apr 2 10:35:29 2018 +0200

    Remove an unnecessary cast in the param to BUF_MEM_grow
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
    (Merged from https://github.com/openssl/openssl/pull/5826)

commit 16e1eea6a67c85c9d786f3c4448182b1aca101b8
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Mon Apr 2 09:13:49 2018 +0200

    Fix range checks with -offset and -length in asn1parse
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
    (Merged from https://github.com/openssl/openssl/pull/5826)

commit 18ada952d1dcea8dfc5008df9f317b3eb47c13fa
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Sun Apr 1 11:02:39 2018 +0200

    Use strtol instead of atoi in asn1parse
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
    (Merged from https://github.com/openssl/openssl/pull/5826)

commit b998745a4596c05f673ed8acdcaedcb4c5e208ad
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Sun Apr 1 00:46:49 2018 +0200

    Improve diagnostics for invalid arguments in asn1parse -strparse
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
    (Merged from https://github.com/openssl/openssl/pull/5826)

commit 752837e0664e990b5edf6f0b69e1b4612efadce0
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Sat Mar 31 21:09:32 2018 +0200

    Fix a crash in the asn1parse command
    
    Thanks to Sem Voigtländer for reporting this issue.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
    (Merged from https://github.com/openssl/openssl/pull/5826)

commit 4f090f76a412a0f69f85621468bd445ea6a65af6
Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
Date:   Mon Apr 2 17:20:04 2018 +0200

    Use gnu_printf format attribute to minimise MinGW warnings
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5839)

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

Summary of changes:
 apps/asn1pars.c       | 20 ++++++++++----------
 include/openssl/bio.h | 22 ++++++++++++++--------
 2 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/apps/asn1pars.c b/apps/asn1pars.c
index a391e0a..62c70b9 100644
--- a/apps/asn1pars.c
+++ b/apps/asn1pars.c
@@ -39,7 +39,7 @@ const OPTIONS asn1parse_options[] = {
     {"dump", OPT_DUMP, 0, "unknown data in hex form"},
     {"dlimit", OPT_DLIMIT, 'p',
      "dump the first arg bytes of unknown data in hex form"},
-    {"strparse", OPT_STRPARSE, 's',
+    {"strparse", OPT_STRPARSE, 'p',
      "offset; a series of these can be used to 'dig'"},
     {OPT_MORE_STR, 0, 0, "into multiple ASN1 blob wrappings"},
     {"genstr", OPT_GENSTR, 's', "string to generate ASN1 structure from"},
@@ -113,13 +113,13 @@ int asn1parse_main(int argc, char **argv)
             offset = strtol(opt_arg(), NULL, 0);
             break;
         case OPT_LENGTH:
-            length = atoi(opt_arg());
+            length = strtol(opt_arg(), NULL, 0);
             break;
         case OPT_DUMP:
             dump = -1;
             break;
         case OPT_DLIMIT:
-            dump = atoi(opt_arg());
+            dump = strtol(opt_arg(), NULL, 0);
             break;
         case OPT_STRPARSE:
             sk_OPENSSL_STRING_push(osk, opt_arg());
@@ -205,7 +205,7 @@ int asn1parse_main(int argc, char **argv)
 
             num = 0;
             for (;;) {
-                if (!BUF_MEM_grow(buf, (int)num + BUFSIZ))
+                if (!BUF_MEM_grow(buf, num + BUFSIZ))
                     goto end;
                 i = BIO_read(in, &(buf->data[num]), BUFSIZ);
                 if (i <= 0)
@@ -225,9 +225,9 @@ int asn1parse_main(int argc, char **argv)
         for (i = 0; i < sk_OPENSSL_STRING_num(osk); i++) {
             ASN1_TYPE *atmp;
             int typ;
-            j = atoi(sk_OPENSSL_STRING_value(osk, i));
-            if (j == 0) {
-                BIO_printf(bio_err, "'%s' is an invalid number\n",
+            j = strtol(sk_OPENSSL_STRING_value(osk, i), NULL, 0);
+            if (j <= 0 || j >= tmplen) {
+                BIO_printf(bio_err, "'%s' is out of range\n",
                            sk_OPENSSL_STRING_value(osk, i));
                 continue;
             }
@@ -258,14 +258,14 @@ int asn1parse_main(int argc, char **argv)
         num = tmplen;
     }
 
-    if (offset >= num) {
-        BIO_printf(bio_err, "Error: offset too large\n");
+    if (offset < 0 || offset >= num) {
+        BIO_printf(bio_err, "Error: offset out of range\n");
         goto end;
     }
 
     num -= offset;
 
-    if ((length == 0) || ((long)length > num))
+    if (length == 0 || length > (unsigned int)num)
         length = (unsigned int)num;
     if (derout != NULL) {
         if (BIO_write(derout, str + offset, length) != (int)length) {
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index 364ff16..2888b42 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -735,7 +735,7 @@ void BIO_copy_next_retry(BIO *b);
  * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
  */
 
-# define __bio_h__attr__(x)
+# define ossl_bio__attr__(x)
 # if defined(__GNUC__) && defined(__STDC_VERSION__) \
     && !defined(__APPLE__)
     /*
@@ -743,19 +743,25 @@ void BIO_copy_next_retry(BIO *b);
      * we can't use __attribute__ with pre C99 dialects.
      */
 #  if __STDC_VERSION__ >= 199901L
-#   undef __bio_h__attr__
-#   define __bio_h__attr__ __attribute__
+#   undef ossl_bio__attr__
+#   define ossl_bio__attr__ __attribute__
+#   if __GNUC__*10 + __GNUC_MINOR__ >= 44
+#    define ossl_bio__printf__ __gnu_printf__
+#   else
+#    define ossl_bio__printf__ __printf__
+#   endif
 #  endif
 # endif
 int BIO_printf(BIO *bio, const char *format, ...)
-__bio_h__attr__((__format__(__printf__, 2, 3)));
+ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3)));
 int BIO_vprintf(BIO *bio, const char *format, va_list args)
-__bio_h__attr__((__format__(__printf__, 2, 0)));
+ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0)));
 int BIO_snprintf(char *buf, size_t n, const char *format, ...)
-__bio_h__attr__((__format__(__printf__, 3, 4)));
+ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4)));
 int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
-__bio_h__attr__((__format__(__printf__, 3, 0)));
-# undef __bio_h__attr__
+ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0)));
+# undef ossl_bio__attr__
+# undef ossl_bio__printf__
 
 
 BIO_METHOD *BIO_meth_new(int type, const char *name);


More information about the openssl-commits mailing list