http: negative/invalid Content-Length raises exception
commitde58973a6025f799ee7897a2cf58bb01eca87631
authorEric Wong <normalperson@yhbt.net>
Mon, 19 Apr 2010 20:40:37 +0000 (19 13:40 -0700)
committerEric Wong <normalperson@yhbt.net>
Mon, 19 Apr 2010 20:49:02 +0000 (19 13:49 -0700)
tree9345e57df498f43956310f531e75e7f4cf560bbd
parent5dd4c12411b5567fb340e897d0b544dfff7fa7a2
http: negative/invalid Content-Length raises exception

...instead of tripping an assertion.

This fixes a potential denial-of-service for servers exposed directly
to untrusted clients.

This bug does not affect supported Unicorn deployments as Unicorn is
only supported with trusted clients (such as nginx) on a LAN.  nginx is
known to reject clients that send invalid Content-Length headers, so any
deployments on a trusted LAN and/or behind nginx are safe.

Servers affected by this bug include (but are not limited to) Rainbows!
and Zbatery.  This does not affect Thin nor Mongrel which never got
request body filtering treatment that the Unicorn HTTP parser got in
August 2009.
ext/unicorn_http/c_util.h
test/unit/test_http_parser_ng.rb