Re: [xml] uri.c bug in libxml2-2.2.3

Date view Thread view Subject view Author view

From: Wayne Davison (wayned@blorf.net)
Date: Wed Sep 20 2000 - 13:53:26 EDT


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


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Sep 20 2000 - 14:43:14 EDT