[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Andy Polyakov appro at openssl.org
Mon Nov 13 10:13:29 UTC 2017


The branch OpenSSL_1_1_0-stable has been updated
       via  a6f4e3fe622764667cc733c0bc1b498032827f44 (commit)
      from  b571802dfaa265082c27f690ead0b4e4b8e2b14c (commit)


- Log -----------------------------------------------------------------
commit a6f4e3fe622764667cc733c0bc1b498032827f44
Author: Andy Polyakov <appro at openssl.org>
Date:   Sat Nov 11 22:14:43 2017 +0100

    asn1/a_strex.c: fix flags truncation in do_esc_char.
    
    |flags| argument to do_esc_char  was apparently truncated by implicit
    cast. [Caught by VC warning subsytem.]
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4721)
    
    (cherry picked from commit 372463103917fcc2b68bd2ba3db55b29ce325705)

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

Summary of changes:
 crypto/asn1/a_strex.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c
index 1bc0679..933dda9 100644
--- a/crypto/asn1/a_strex.c
+++ b/crypto/asn1/a_strex.c
@@ -63,7 +63,7 @@ typedef int char_io (void *arg, const void *buf, int len);
  * even 4 byte forms.
  */
 
-static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes,
+static int do_esc_char(unsigned long c, unsigned short flags, char *do_quotes,
                        char_io *io_ch, void *arg)
 {
     unsigned short chflgs;
@@ -116,7 +116,7 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes,
      * If we get this far and do any escaping at all must escape the escape
      * character itself: backslash.
      */
-    if (chtmp == '\\' && flags & ESC_FLAGS) {
+    if (chtmp == '\\' && (flags & ESC_FLAGS)) {
         if (!io_ch(arg, "\\\\", 2))
             return -1;
         return 2;
@@ -143,6 +143,7 @@ static int do_buf(unsigned char *buf, int buflen,
     unsigned short orflags;
     unsigned char *p, *q;
     unsigned long c;
+
     p = buf;
     q = buf + buflen;
     outlen = 0;
@@ -190,17 +191,15 @@ static int do_buf(unsigned char *buf, int buflen,
                  * otherwise each character will be > 0x7f and so the
                  * character will never be escaped on first and last.
                  */
-                len =
-                    do_esc_char(utfbuf[i], (unsigned short)(flags | orflags),
-                                quotes, io_ch, arg);
+                len = do_esc_char(utfbuf[i], flags | orflags, quotes,
+                                  io_ch, arg);
                 if (len < 0)
                     return -1;
                 outlen += len;
             }
         } else {
-            len =
-                do_esc_char(c, (unsigned short)(flags | orflags), quotes,
-                            io_ch, arg);
+            len = do_esc_char(c, flags | orflags, quotes,
+                              io_ch, arg);
             if (len < 0)
                 return -1;
             outlen += len;


More information about the openssl-commits mailing list