httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [patch 1.3] avoid segfaults in ap_unescape_url with empty strings
Date Wed, 19 Feb 2003 05:14:04 GMT
This ia an apache-1.3 issue

Richard Clarke <ric@likewhoa.com> has reported the following segfault on the 
modperl list. The following patch tries to prevent the segfault:

Program received signal SIGBUS, Bus error.
0x80b445b in ap_unescape_url (url=0x8162e89 "") at util.c:1609
1609        url[x] = '\0';
(gdb) bt
#0  0x80b445b in ap_unescape_url (url=0x8162e89 "") at util.c:1609
#1  0x8085c20 in XS_Apache_unescape_url (cv=0x8227b0c) at Apache.c:931
[...]

Index: src/main/util.c
===================================================================
RCS file: /home/cvspublic/apache-1.3/src/main/util.c,v
retrieving revision 1.206
diff -u -r1.206 util.c
--- src/main/util.c     18 Jun 2002 00:59:58 -0000      1.206
+++ src/main/util.c     19 Feb 2003 05:12:04 -0000
@@ -1588,6 +1588,10 @@
  {
      register int x, y, badesc, badpath;

+    /* if the url is empty just return */
+    if (url && url[0] == '\0')
+        return OK;
+
      badesc = 0;
      badpath = 0;
      for (x = 0, y = 0; url[y]; ++x, ++y) {



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message