httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <>
Subject [PATCH] (PR#130) mod_imap infinite loop fix
Date Sat, 08 Feb 1997 09:31:09 GMT
This patch fixes PR#130 by assuming that any 'base' in an imagemap
file refers to a directory.  The only incompatible behavior it can 
cause is that now the server won't go into an infinite loop when
it gets such a request.  It is arguable that it should treat a base
without a '/' as a file to which the rest should be appended, but
I think this way makes more sense.

A little look will show you that if strlen(my_base == sizeof(my_base) - 1
the loop will still be there, but there appear to be a million other
things that can screw up so I'm not going to worry... the whole thing
needs a rewrite.

Unrelated to this, note that:

	base basedir/
	rect ../dir/test.html 0,0 499,77

will point to to basedir/dir/test.html because the function to
check for the directory in base is messed up.  I looked at fixing
it, but not only does it introduce a different behavior, but it
isn't trivial to fix.  All that parsing code is a mess.  I tracked
down this second problem to a relatively small bit of code, but don't
want to spend the effort right now to figure out what the heck it
is trying to do...

Index: mod_imap.c
RCS file: /export/home/cvs/apache/src/mod_imap.c,v
retrieving revision 1.17
diff -c -r1.17 mod_imap.c
*** mod_imap.c	1997/01/27 00:16:18	1.17
--- mod_imap.c	1997/02/08 09:24:42
*** 424,429 ****
--- 424,433 ----
    strncpy(my_base, base, sizeof(my_base)-1);  /* must be a relative URL to be combined with
base */
    my_base[sizeof(my_base)-1] = '\0';
+   if (strchr(my_base, '/') == NULL && strlen(my_base) < sizeof(my_base) - 2)
+     my_base[strlen(my_base)] = '/';
+     my_base[strlen(my_base)] = '\0'; 
+   }
    string_pos = my_base; 
    while (*string_pos) {  
      if (*string_pos == '/' && *(string_pos+1) == '/') {

View raw message