[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Patch: add constraints on HTTP first line/headers/body size



Hi,

On Thu, Oct 8, 2009 at 12:54 AM, Victor Goya <bebephoque@xxxxxxxxx> wrote:
I guess it's because size_t is usually an unsigned int, thus
((size_t)-1) == 2^32-1.
Some users may want to use the maximum size available that doesn't exceed
the size they can handle with size_t and write something like :
evhttp_set_max_body_size(http, UINT32_MAX);

This may lead to an unexpected behavior. Perhaps you can define something like :
EVHTTP_SIZE_MAX ((size_t)-2)
 
Well, (size_t)-1 is a max value of size_t b/c it's unsigned integer type according to C99 ( that's why it's reasonable for -1 to be some kind of 'special'  value of size_t). I still don't realize why it can lead to unexpected behavior.

--
WBR,
Constantine