Re: Limiting maximum RPC message length
Gerd Stolpmann <[email protected]> Tue, 11 Aug 2009 23:04:24 +0200
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <[email protected]> |
Am Sonntag, den 09.08.2009, 18:48 +0200 schrieb Hans Ole Rafaelsen: > Hi. > > The message length given in the RPC message is checked for validity in > that the message length is less than Sys.max_string_length. If that is > found to hold, a string with the size given in the message is created. > > On a 32bit system this is 32MB but on a 64bit this value is fairly > large. So just connecting to a RPC server and sending some 'junk' (e.g: > echo dddd | nc 127.0.0.1 10000 -q 1) causes the application to allocate > several gigabytes of memory. > > Here is a simple patch for rpc_transport.ml(i) that allows the user to > set the maximum length of RPC messages. Can something along these lines > be included into further versions on Ocamlnet? Well, there is such a mechanism in rpc_server.ml, but seems to be partly non-functional. The interface is Rpc_server.set_session_filter, e.g. Rpc_server.set_session_filter srv (fun _ -> `Accept_limit_length(n, `Drop) (* accept messages up to n bytes, and if exceeded, drop the message *) This admittedly does not work, and there must have been some regression. For clients, there is no such mechanism, but is probably easy to add. Anyway, I've added this to my TODO list. Gerd > > Kindest regards, > > Hans Ole Rafaelsen > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ Ocamlnet-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel -- ------------------------------------------------------------ Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany [email protected] http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july