You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2002/07/05 00:19:14 UTC

cvs commit: xml-xerces/c/src/xercesc/util XMLUri.cpp

peiyongz    2002/07/04 15:19:13

  Modified:    c/src/xercesc/util XMLUri.cpp
  Log:
  Bug# 10482: XMLUri crashes with empty fragment.
  
  Revision  Changes    Path
  1.2       +18 -6     xml-xerces/c/src/xercesc/util/XMLUri.cpp
  
  Index: XMLUri.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLUri.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLUri.cpp	1 Feb 2002 22:22:17 -0000	1.1
  +++ XMLUri.cpp	4 Jul 2002 22:19:13 -0000	1.2
  @@ -794,13 +794,25 @@
           }
   
           if (getFragment())
  -        {
               delete [] fFragment;
  -        }
  -
  -        fFragment = new XMLCh[index - start + 1];
  -        XMLString::subString(fFragment, uriSpec, start, index);
   
  +        //make sure that there is something following the '#'
  +        if (index > start)
  +        {
  +            fFragment = new XMLCh[index - start + 1];
  +            XMLString::subString(fFragment, uriSpec, start, index);
  +        }
  +        else 
  +        {
  +            // RFC 2396, 4.0. URI Reference
  +            // URI-reference = [absoulteURI | relativeURI] [# fragment]
  +            //
  +            // RFC 2396, 4.1. Fragment Identifier
  +            // fragment = *uric 
  +            // 
  +            // empty fragment is valid
  +            fFragment = 0;
  +        }
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org