$NetBSD: patch-ar,v 1.1.2.2 2004/11/15 21:26:45 salo Exp $

--- lib/cgi.rb.orig	2002-08-29 18:05:06.000000000 +0900
+++ lib/cgi.rb
@@ -823,10 +823,13 @@ convert string charset, and set language
           end
 
           c = if bufsize < content_length
-                stdinput.read(bufsize) or ''
+                stdinput.read(bufsize)
               else
-                stdinput.read(content_length) or ''
+                stdinput.read(content_length)
               end
+	  if c.nil?
+	    raise EOFError, "bad content body"
+	  end
           buf += c
           content_length -= c.size
 
