]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Fix NULL pointer dereference error introduced during get_path "fixing" 535/head
authorPeter Stamfest <peter@stamfest.at>
Thu, 4 Sep 2014 18:40:00 +0000 (20:40 +0200)
committerPeter Stamfest <peter@stamfest.at>
Thu, 4 Sep 2014 18:40:00 +0000 (20:40 +0200)
src/rrd_client.c

index 5f2366dfe1f4224010e965d86ed1181cadc2cf4e..e547d6c635a80c17ff60ca4e317d9382df3fe9d5 100644 (file)
@@ -119,7 +119,12 @@ static const char *get_path (const char *path, char *resolved_path) /* {{{ */
             if (ret == NULL) {
               rrd_set_error("realpath(%s): %s", path, rrd_strerror(errno));
             } else {
-                strcat(buffer, lastslash);
+                if (lastslash != NULL) {
+                    strcat(buffer, lastslash);
+                } else {
+                    strcat(buffer, "/");
+                    strcat(buffer, path);
+                }
                 if (resolved_path == NULL) {
                     ret = strdup(buffer);
                 } else {