# HG changeset patch # User Olaf Wintermann # Date 1721596780 -7200 # Node ID f9e40f5c6dafcd4a348c02a01e64bff839d53f4c # Parent 9b1e998eeac67d2da61fa5902243aaac65bc5e29 fix dav_set_string_property crash if an unknown namespace prefix was specified diff -r 9b1e998eeac6 -r f9e40f5c6daf dav/main.c --- a/dav/main.c Fri May 24 00:27:40 2024 +0200 +++ b/dav/main.c Sun Jul 21 23:19:40 2024 +0200 @@ -1877,7 +1877,9 @@ if(namespace) { dav_set_string_property_ns(res, namespace, property, value); } else { - dav_set_string_property(res, property, value); + if(dav_set_string_property(res, property, value)) { + fprintf(stderr, "%s\n", res->session->errorstr); + } } } diff -r 9b1e998eeac6 -r f9e40f5c6daf libidav/resource.c --- a/libidav/resource.c Fri May 24 00:27:40 2024 +0200 +++ b/libidav/resource.c Sun Jul 21 23:19:40 2024 +0200 @@ -606,11 +606,16 @@ return property; } -void dav_set_string_property(DavResource *res, char *name, char *value) { +int dav_set_string_property(DavResource *res, char *name, char *value) { char *pns; char *pname; dav_get_property_namespace_str(res->session->context, name, &pns, &pname); + if(!pns) { + res->session->errorstr = "Property namespace not found"; + return 1; + } dav_set_string_property_ns(res, pns, pname, value); + return 0; } static int add2propertylist(const CxAllocator *a, CxList **list, DavProperty *property) { diff -r 9b1e998eeac6 -r f9e40f5c6daf libidav/webdav.h --- a/libidav/webdav.h Fri May 24 00:27:40 2024 +0200 +++ b/libidav/webdav.h Sun Jul 21 23:19:40 2024 +0200 @@ -358,7 +358,7 @@ DavXmlNode* dav_get_encrypted_property_ns(DavResource *res, const char *ns, const char *name); char* dav_get_string_property(DavResource *res, char *name); char* dav_get_string_property_ns(DavResource *res, char *ns, char *name); -void dav_set_string_property(DavResource *res, char *name, char *value); +int dav_set_string_property(DavResource *res, char *name, char *value); void dav_set_string_property_ns(DavResource *res, char *ns, char *name, char *value); void dav_set_property(DavResource *res, char *name, DavXmlNode *value); void dav_set_property_ns(DavResource *res, char *ns, char *name, DavXmlNode *value);