fix null pointer dereferenciation v1.2

Sat, 09 Mar 2019 16:29:59 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 09 Mar 2019 16:29:59 +0100
branch
v1.2
changeset 593
3d02420c4392
parent 592
27382d82c8b3
child 594
23608c2e1de9

fix null pointer dereferenciation

libidav/resource.c file | annotate | diff | comparison | revisions
--- a/libidav/resource.c	Tue Nov 13 21:16:27 2018 +0100
+++ b/libidav/resource.c	Sat Mar 09 16:29:59 2019 +0100
@@ -82,7 +82,7 @@
 DavResource* dav_resource_new_full(DavSession *sn, char *parent_path, char *name, char *href) {
     sstr_t n = sstr(name);
     // the name must not contain path separators
-    if(n.length > 0) {
+    if(n.length > 0 && href) {
         for(int i=0;i<n.length-1;i++) {
             char c = n.ptr[i];
             if(c == '/' || c == '\\') {

mercurial