From: Peter Stamfest Date: Thu, 4 Sep 2014 18:40:00 +0000 (+0200) Subject: Fix NULL pointer dereference error introduced during get_path "fixing" X-Git-Tag: v1.5.0-rc1~44^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F535%2Fhead;p=thirdparty%2Frrdtool-1.x.git Fix NULL pointer dereference error introduced during get_path "fixing" --- diff --git a/src/rrd_client.c b/src/rrd_client.c index 5f2366df..e547d6c6 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -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 {