fix crash if the server sends a response with elements without namespaces

Sun, 19 Mar 2023 15:12:42 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 19 Mar 2023 15:12:42 +0100
changeset 743
716f6bf04c30
parent 741
e9a5dd08258d
child 744
f0d7178043c1

fix crash if the server sends a response with elements without namespaces

dav/Makefile file | annotate | diff | comparison | revisions
libidav/Makefile file | annotate | diff | comparison | revisions
libidav/methods.c file | annotate | diff | comparison | revisions
--- a/dav/Makefile	Wed Nov 02 11:45:56 2022 +0100
+++ b/dav/Makefile	Sun Mar 19 15:12:42 2023 +0100
@@ -78,9 +78,9 @@
 	$(LD) -o ../build/xattrtool$(APP_EXT) $(XATTR_OBJ) $(LDFLAGS)
 
 ../build/tool/%$(OBJ_EXT): %.c 
-	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I../ -I../ucx -o $@ $<
+	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I../ -I../ucx/ -o $@ $<
 
 
 cppcheck: $(DAV_SRC) $(SYNC_SRC)
-	$(CPPCHECK) $(CPPCHECK_CONFIG) $(CPPCHECK_FLAGS) -I../ucx -I../ $+ 2>> ../$(CPPCHECK_LOG)
+	$(CPPCHECK) $(CPPCHECK_CONFIG) $(CPPCHECK_FLAGS) -I../ -I../ucx -I../ $+ 2>> ../$(CPPCHECK_LOG)
 
--- a/libidav/Makefile	Wed Nov 02 11:45:56 2022 +0100
+++ b/libidav/Makefile	Sun Mar 19 15:12:42 2023 +0100
@@ -50,7 +50,7 @@
 	$(AR) $(ARFLAGS) $(AOFLAGS)../build/libidav$(LIB_EXT) $(OBJ)
 
 ../build/libidav/%$(OBJ_EXT): %.c
-	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I.. -I../ucx $(COFLAGS)$@ $<
+	$(CC) -I../ucx/  $(CFLAGS) $(DAV_CFLAGS) $(COFLAGS)$@ $<
 
 cppcheck: $(SRC)
 	$(CPPCHECK) $(CPPCHECK_CONFIG) $(CPPCHECK_FLAGS) -I../ucx $+ 2>> ../$(CPPCHECK_LOG)
--- a/libidav/methods.c	Wed Nov 02 11:45:56 2022 +0100
+++ b/libidav/methods.c	Sun Mar 19 15:12:42 2023 +0100
@@ -656,7 +656,7 @@
                                 if(parse_resource_type(n)) {
                                     iscollection = TRUE;
                                 }
-                            } else if(xstreq(n->ns->href, DAV_NS)) {
+                            } else if(n->ns && xstreq(n->ns->href, DAV_NS)) {
                                 if(xstreq(n->name, "crypto-name")) {
                                     crypto_name = util_xml_get_text(n);
                                 } else if(xstreq(n->name, "crypto-key")) {
@@ -713,6 +713,9 @@
     
     UCX_FOREACH(elm, properties) {
         xmlNode *prop = elm->data;
+        if(!prop->ns) {
+            continue;
+        }
         resource_add_property(res, (char*)prop->ns->href, (char*)prop->name, prop->children);
         
         if (decrypt_props &&

mercurial