Instead of a local hack, implement SIZE_MAX in numbers.h if it's missing
Reviewed-by: Stephen Henson <steve@openssl.org>
This commit is contained in:
parent
6aa0ba4bb2
commit
1de1d7689a
@ -105,5 +105,9 @@
|
|||||||
# define UINT64_MAX __MAXUINT__(uint64_t)
|
# define UINT64_MAX __MAXUINT__(uint64_t)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifndef SIZE_MAX
|
||||||
|
# define SIZE_MAX __MAXUINT__(size_t)
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@
|
|||||||
# include <openssl/crypto.h>
|
# include <openssl/crypto.h>
|
||||||
# include <openssl/e_os2.h>
|
# include <openssl/e_os2.h>
|
||||||
|
|
||||||
|
# include "internal/numbers.h"
|
||||||
|
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
@ -111,13 +113,8 @@ __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf,
|
|||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
/* Sanity check for negative values. */
|
/* Sanity check for negative values. */
|
||||||
#ifdef SIZE_MAX
|
|
||||||
if (len > (size_t)(SIZE_MAX / 2))
|
if (len > (size_t)(SIZE_MAX / 2))
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
|
||||||
if (len > ((size_t)2 << (sizeof(size_t) * 8 - 1)))
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pkt->curr = buf;
|
pkt->curr = buf;
|
||||||
pkt->remaining = len;
|
pkt->remaining = len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user