Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -505,12 +505,17 @@ } if (contentLength > 0) { char *buffer; + if (contentLength < 0 || + (uintmax_t)contentLength > SIZE_MAX) + @throw [OFOutOfRangeException exception]; + buffer = [self allocMemoryWithSize: BUFFER_SIZE]; _body = [[OFMutableData alloc] init]; + _contentLength = contentLength; [_socket asyncReadIntoBuffer: buffer length: BUFFER_SIZE target: self selector: @selector(socket: