Fri, 22 Sep 2017 20:19:00 +0200
fixes possible UAF for locktocken paths, if file could not be opened
dav/sync.c | file | annotate | diff | comparison | revisions |
--- a/dav/sync.c Sun Sep 17 17:56:02 2017 +0200 +++ b/dav/sync.c Fri Sep 22 20:19:00 2017 +0200 @@ -1862,13 +1862,14 @@ free(fname.ptr); FILE *file = fopen(path, "w"); - if(!file) { + if(file) { + fprintf(file, "%s\n", locktoken); + fclose(file); + return path; + } else { perror("Cannot create locktoken file"); free(path); + return NULL; } - - fprintf(file, "%s\n", locktoken); - fclose(file); - return path; }