]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
src/rrd_daemon.c: never compare uninitialized bytes 819/head
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Tue, 12 Sep 2017 16:11:50 +0000 (17:11 +0100)
committerAlan Jenkins <alan.christopher.jenkins@gmail.com>
Tue, 12 Sep 2017 16:11:50 +0000 (17:11 +0100)
I don't think this caused the valgrind error in CI either.  It looks wrong
though.

src/rrd_daemon.c

index 937b86ae8f01091a7adfeb1af6f6858820c10b3a..6159ea3012156255f634f9e0a9eb91675f3a47b0 100644 (file)
@@ -2576,7 +2576,8 @@ static int handle_request_list (HANDLER_PROTO) /* {{{ */
     }
 
     /* Absolute path MUST be starting with base_dir; if not skip the entry. */
-    if (memcmp(absolute, base, strlen(base)) != 0) {
+    if (strlen(absolute) < strlen(base) ||
+        memcmp(absolute, base, strlen(base)) != 0) {
       goto loop_next;
   }
     add_response_info(sock, "%s\n", current);