diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-11-04 20:17:32 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-11-04 20:17:32 +0000 |
commit | 47bad8abb70c49f1d2bc1ddbc13ec7ec96bc20f5 (patch) | |
tree | bdf4a326cd0cc91223201d1d9b4f05a4f75a379d /util-internal.h | |
parent | 86db1c851be804b13aadebcc0b1a21a4493192dd (diff) | |
download | libevent-47bad8abb70c49f1d2bc1ddbc13ec7ec96bc20f5.tar.gz |
Implement size limits on HTTP header length and body length.
Patch from Constantine Verutin, simplified a little.
svn:r1500
Diffstat (limited to 'util-internal.h')
-rw-r--r-- | util-internal.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/util-internal.h b/util-internal.h index ef82af99..3c243d63 100644 --- a/util-internal.h +++ b/util-internal.h @@ -36,6 +36,7 @@ #ifdef _EVENT_HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif +#include "event2/util.h" #ifdef __cplusplus extern "C" { @@ -167,6 +168,41 @@ int evutil_resolve(int family, const char *hostname, struct sockaddr *sa, } \ } while(0) +#ifdef UINT64_MAX +#define EV_UINT64_MAX UINT64_MAX +#elif defined(WIN32) +#define EV_UINT64_MAX 0xffffffffffffffffui64 +#elif _EVENT_SIZEOF_LONG_LONG == 8 +#define EV_UINT64_MAX 0xffffffffffffffffull +#elif _EVENT_SIZEOF_LONG == 8 +#define EV_UINT64_MAX 0xfffffffffffffffful +#else +/* Hope for a two's complement representation */ +#define EV_UINT64_MAX ((ev_uint64_t)-1) +#endif + +#ifdef UINT32_MAX +#define EV_UINT32_MAX UINT32_MAX +#elif defined(WIN32) +#define EV_UINT32_MAX 0xffffffffui64 +#elif _EVENT_SIZEOF_INT == 4 +#define EV_UINT32_MAX 0xffffffffu +#elif _EVENT_SIZEOF_LONG == 4 +#define EV_UINT32_MAX 0xfffffffful +#else +/* Hope for a two's complement representation */ +#define EV_UINT32_MAX ((ev_uint32_t)-1) +#endif + +#if _EVENT_SIZEOF_SIZE_T == 8 +#define EV_SIZE_MAX EV_UINT64_MAX +#elif _EVENT_SIZEOF_SIZE_T == 4 +#define EV_SIZE_MAX EV_UINT32_MAX +#else +/* Hope for a two's complement representation */ +#define EV_SIZE_MAX ((size_t)-1) +#endif + #ifdef __cplusplus } #endif |