[libxml2] Bug 565747 – relax anyURI data character checking



commit 933e5de96c406e669f8859557c960929e8f20741
Author: Vincent Lefevre <vincent+gnome vinc17 org>
Date:   Fri Aug 7 16:42:24 2009 +0200

    Bug 565747 â?? relax anyURI data character checking
    
    * xmlschemastypes.c: anyURI values that contain an apostrophe or a
      space character or any non-ascii char were rejected, this is opposed
      to XSD-1.0 datatype rules

 xmlschemastypes.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 0d967d0..1ce21e1 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -2899,12 +2899,23 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
         case XML_SCHEMAS_ANYURI:{		
                 if (*value != 0) {
 		    xmlURIPtr uri;
+		    xmlChar *tmpval, *cur;
 		    if (normOnTheFly) {		    
 			norm = xmlSchemaCollapseString(value);
 			if (norm != NULL)
 			    value = norm;
 		    }
-                    uri = xmlParseURI((const char *) value);
+		    tmpval = xmlStrdup(value);
+		    for (cur = tmpval; *cur; ++cur) {
+			if (*cur < 32 || *cur >= 127 || *cur == ' ' ||
+			    *cur == '<' || *cur == '>' || *cur == '"' ||
+			    *cur == '{' || *cur == '}' || *cur == '|' ||
+			    *cur == '\\' || *cur == '^' || *cur == '`' ||
+			    *cur == '\'')
+			    *cur = '_';
+		    }
+                    uri = xmlParseURI((const char *) tmpval);
+		    xmlFree(tmpval);
                     if (uri == NULL)
                         goto return1;
                     xmlFreeURI(uri);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]