fixes format string containing the NUL character instead of printing the NUL character in get_random_name()

Tue, 26 Feb 2019 10:34:10 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 26 Feb 2019 10:34:10 +0100
changeset 514
4b84437b2167
parent 513
893a659768b3
child 515
2465dd550bb5

fixes format string containing the NUL character instead of printing the NUL character in get_random_name()

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Tue Feb 26 10:29:14 2019 +0100
+++ b/dav/sync.c	Tue Feb 26 10:34:10 2019 +0100
@@ -2110,7 +2110,7 @@
     dav_rand_bytes(name_prefix, 8);   
     char *pre = util_hexstr(name_prefix, 8);
     int64_t ts = (int64_t)time(NULL);
-    int w = snprintf(buf, len, "%s-%"PRId64"\0", pre, ts);
+    int w = snprintf(buf, len, "%s-%"PRId64"%c", pre, ts, '\0');
     free(pre);
     return w >= len;
 }

mercurial