[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Mon Apr 18 14:28:57 UTC 2016


The branch master has been updated
       via  235f9329304ab9e75e43dc5a409901fc3b3de9ca (commit)
      from  36c6f0ad0f1464d47493309c24e2275af7f09c1e (commit)


- Log -----------------------------------------------------------------
commit 235f9329304ab9e75e43dc5a409901fc3b3de9ca
Author: Matt Caswell <matt at openssl.org>
Date:   Mon Apr 18 15:12:58 2016 +0100

    Unsigned chars can't be negative
    
    Fix a problem where an unsigned char was being checked to see if it was
    negative.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>

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

Summary of changes:
 crypto/o_str.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/crypto/o_str.c b/crypto/o_str.c
index 9811e2d..660226f 100644
--- a/crypto/o_str.c
+++ b/crypto/o_str.c
@@ -243,6 +243,7 @@ unsigned char *OPENSSL_hexstr2buf(const char *str, long *len)
 {
     unsigned char *hexbuf, *q;
     unsigned char ch, cl;
+    int chi, cli;
     const unsigned char *p;
     size_t s;
 
@@ -262,14 +263,14 @@ unsigned char *OPENSSL_hexstr2buf(const char *str, long *len)
             OPENSSL_free(hexbuf);
             return NULL;
         }
-        cl = OPENSSL_hexchar2int(cl);
-        ch = OPENSSL_hexchar2int(ch);
-        if (cl < 0 || ch < 0) {
+        cli = OPENSSL_hexchar2int(cl);
+        chi = OPENSSL_hexchar2int(ch);
+        if (cli < 0 || chi < 0) {
             OPENSSL_free(hexbuf);
             CRYPTOerr(CRYPTO_F_OPENSSL_HEXSTR2BUF, CRYPTO_R_ILLEGAL_HEX_DIGIT);
             return NULL;
         }
-        *q++ = (ch << 4) | cl;
+        *q++ = (unsigned char)((chi << 4) | cli);
     }
 
     if (len)


More information about the openssl-commits mailing list