[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Sat Jan 2 20:11:55 UTC 2016


The branch master has been updated
       via  1de1d7689a81f2a3ed3348926e6a31ef79a2bc15 (commit)
      from  6aa0ba4bb2833b1e0d6ae98c54c79bfed8257c3a (commit)


- Log -----------------------------------------------------------------
commit 1de1d7689a81f2a3ed3348926e6a31ef79a2bc15
Author: Richard Levitte <levitte at openssl.org>
Date:   Sat Jan 2 19:19:00 2016 +0100

    Instead of a local hack, implement SIZE_MAX in numbers.h if it's missing
    
    Reviewed-by: Stephen Henson <steve at openssl.org>

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

Summary of changes:
 include/internal/numbers.h | 4 ++++
 ssl/packet_locl.h          | 7 ++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/internal/numbers.h b/include/internal/numbers.h
index 1f79ef7..da06dab 100644
--- a/include/internal/numbers.h
+++ b/include/internal/numbers.h
@@ -105,5 +105,9 @@
 #  define UINT64_MAX __MAXUINT__(uint64_t)
 # endif
 
+# ifndef SIZE_MAX
+#  define SIZE_MAX __MAXUINT__(size_t)
+# endif
+
 #endif
 
diff --git a/ssl/packet_locl.h b/ssl/packet_locl.h
index 48a5f3d..ed7c1ca 100644
--- a/ssl/packet_locl.h
+++ b/ssl/packet_locl.h
@@ -65,6 +65,8 @@
 # include <openssl/crypto.h>
 # include <openssl/e_os2.h>
 
+# include "internal/numbers.h"
+
 # ifdef __cplusplus
 extern "C" {
 # endif
@@ -111,13 +113,8 @@ __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf,
                                               size_t len)
 {
     /* Sanity check for negative values. */
-#ifdef SIZE_MAX
     if (len > (size_t)(SIZE_MAX / 2))
         return 0;
-#else
-    if (len > ((size_t)2 << (sizeof(size_t) * 8 - 1)))
-        return 0;
-#endif
 
     pkt->curr = buf;
     pkt->remaining = len;


More information about the openssl-commits mailing list