From: Marc Sanfacon (sanm@copernic.com)
Date: Wed Sep 20 2000 - 14:14:28 EDT
Hi Wayne,
        it is true that index is 0 at this point.  But am I right when
saying that 'ref' could be an absolute path ?
i.e.  /index.htm
        In which case, we must ensure that it doesn't starts with '/',
otherwise we would have 2 '/'.
regards,
        Marc.
-----Original Message-----
From: xml-request@rufus.w3.org [mailto:xml-request@rufus.w3.org]On
Behalf Of Wayne Davison
Sent: September 20, 2000 13:53
To: 'xml@rpmfind.net'
Subject: Re: [xml] uri.c bug in libxml2-2.2.3
On Wed, 20 Sep 2000, Marc Sanfacon wrote:
> 	In my case, 'out' is 0, so it doesn't go in the test.
One thing I noticed when looking at your patch is that both the existing
code and your patched version test if ref->path[index] != '/'.  This is
not necessary since we know that ref is a relative path (and we also know
that "index" is 0 at this point).  Here is how I would patch the original
code:
Index: uri.c
@@ -1547,15 +1547,13 @@
      * b) The reference's path component is appended to the buffer
      *    string.
      */
-    if (ref->path != NULL) {
+    if (ref->path != NULL && ref->path[0] != 0) {
         index = 0;
         /*
          * Ensure the path includes a '/'
          */
-	if ((out >0) && (res->path[out -1] != '/') &&
-	    (ref->path[0] != 0) && (ref->path[index] != '/')) {
+	if ((out == 0) || (res->path[out - 1] != '/'))
             res->path[out++] = '/';
-	}
         while (ref->path[index] != 0) {
             res->path[out++] = ref->path[index++];
         }
..wayne..
---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net ---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net
This archive was generated by hypermail 2b29 : Wed Sep 20 2000 - 14:43:14 EDT