Patch: requests without user-agent

[email protected] Sun, 4 Nov 2007 19:24:51 +0100
Newsgroups gmane.comp.web.fnord
Organization [ t]ivano Software GmbH
Message-ID <[email protected]>
--Boundary-00=_05gLHOqUyrp90qq
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,

I've noticed that fnord will try to dereference null pointer if a request
doesn't contain a user-agent header. See the attached patch.

Bye,
	Peter
=2D-=20
Peter Conrad      | "Hi! I'm a signature virus! Copy me to your .signature,
Alicestra=DFe 102   |  pleeeeeeeeeze!"   - found in someone else's .signatu=
re
63263 Neu-Isenburg
Germany

  email: [email protected] / WWW: http://www.unix-ag.uni-kl.de/~conr=
ad

--Boundary-00=_05gLHOqUyrp90qq
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="fnord-1.10-ua.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="fnord-1.10-ua.patch"

diff -rU3 fnord-1.10.orig/httpd.c fnord-1.10/httpd.c
--- fnord-1.10.orig/httpd.c	2005-08-03 13:32:50.000000000 +0200
+++ fnord-1.10/httpd.c	2007-11-04 19:17:17.000000000 +0100
@@ -228,6 +228,7 @@
   sanitize(host);
   buffer_puts(buffer_2,host);
   buffer_putspace(buffer_2);
+  if (!ua) ua="none";
   sanitize(ua);
   buffer_puts(buffer_2,ua);
   buffer_putspace(buffer_2);
@@ -1390,7 +1391,7 @@
   }
 
 #ifdef TARPIT
-  if (str_equal(ua,"EmailSiphon")) { sleep(120); exit(0); }
+  if (ua && str_equal(ua,"EmailSiphon")) { sleep(120); exit(0); }
 #endif
 
   port=getenv("TCPLOCALPORT");
Nur in fnord-1.10: httpd.c.orig.

--Boundary-00=_05gLHOqUyrp90qq--