Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 1108 invoked by uid 6000); 30 Dec 1997 18:14:04 -0000 Received: (qmail 1102 invoked from network); 30 Dec 1997 18:14:02 -0000 Received: from twinlark.arctic.org (204.62.130.91) by taz.hyperreal.org with SMTP; 30 Dec 1997 18:14:02 -0000 Received: (qmail 26322 invoked by uid 500); 30 Dec 1997 18:15:09 -0000 Date: Tue, 30 Dec 1997 10:15:09 -0800 (PST) From: Dean Gaudet To: new-httpd@apache.org Subject: [PATCH] 1.2: "DoS" attack Message-ID: X-Comment: Visit http://www.arctic.org/~dgaudet/legal for information regarding copyright and disclaimer. Organization: Transmeta Corp. MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Otherwise known as "O(n^2) loops are lame". Dean Index: src/util.c =================================================================== RCS file: /export/home/cvs/apache/src/util.c,v retrieving revision 1.52.2.2 diff -u -r1.52.2.2 util.c --- util.c 1997/06/27 01:47:47 1.52.2.2 +++ util.c 1997/12/30 18:09:15 @@ -328,14 +328,22 @@ } } -void no2slash(char *name) { - register int x,y; +void no2slash(char *name) +{ + char *d, *s; - for(x=0; name[x];) - if(x && (name[x-1] == '/') && (name[x] == '/')) - for(y=x+1;name[y-1];y++) - name[y-1] = name[y]; - else x++; + s = d = name; + while (*s) { + if ((*d++ = *s) == '/') { + do { + ++s; + } while (*s == '/'); + } + else { + ++s; + } + } + *d = '\0'; } char *make_dirstr(pool *p, const char *s, int n) {